Jump to content

Export to PDF


Recommended Posts

I developed a plugin for an other graphic tool (and still maintaining it) which supports generating of PFDs from bitmaps. It supports soft masks, optional content (layers) and in the future blend modes simular to PDN or Photoshop. The plugin has been written in plain C. I'm thinking about to write a C# wrapper for PDN. The generated PDF would allow to switch on and off layers in Acrobat Reader (I'm not sure whether an other PDF viewer supports this or not).

Do you think that people are interested in such a plugin?

Is it allowed and possible to call an other plugin from a PDN plugin? (I'm not willing to publish the source code of the plain c code in the moment).

I have no experience in C# but in other languages like smalltalk, c++, lisp, ... So I'm guessing it should not be a big problem to get in C#, or?

Still it would take some time to do the job ;-)

Any hints, frameworks or tools for a filetype plugin are welcome.

Martin

midoras signature.gif

Link to comment
Share on other sites

My answers ;-)

Do you think that people are interested in such a plugin?

No answers, so I would say it is just me.

Is it allowed and possible to call an other plugin from a PDN plugin? (I'm not willing to publish the source code of the plain c code in the moment).

Yes, because the plugin to use photoshop filters does the same.

I have no experience in C# but in other languages like smalltalk, c++, lisp, ... So I'm guessing it should not be a big problem to get in C#, or?

Still it would take some time to do the job ;-)

Started, not a big deal.

Any hints, frameworks or tools for a filetype plugin are welcome.

Using MS Visual C# Express 2010 works fine.

I tested this by modifying an existing pdn filetype plugin.

midoras signature.gif

Link to comment
Share on other sites

Is it allowed and possible to call an other plugin from a PDN plugin? (I'm not willing to publish the source code of the plain c code in the moment).

You could put the PDF saving in a separate dlls for both x86 and x64 and export the functions you need from the dlls, this is how the WebP file type works.

Then using Pinvoke you can call the exported functions from the dll, determining at runtime what platform you are running under.

for example:


private static class PDF32 {
[DllImport("PdfIO_x86.dll", EntryPoint ="AddImageToPDF")]
static extern void AddImageToPDF(byte[] imageData, int width, int height, int stride);
}
private static class PDF64 {
[DllImport("PdfIO_x64.dll", EntryPoint ="AddImageToPDF")]
static extern void AddImageToPDF(byte[] imageData, int width, int height, int stride);
}
private void AddImageToPDF(byte[] imageData, int width, int height, int stride)
{
	if (IntPtr.Size == 8) // 64-bit
	{
	PDF64.AddImageToPDF(byte[] imageData, int width, int height, int stride);
	}
	else
	{
	PDF32.AddImageToPDF(byte[] imageData, int width, int height, int stride)
	}

}

PdnSig.png

Plugin Pack | PSFilterPdn | Content Aware Fill | G'MICPaint Shop Pro Filetype | RAW Filetype | WebP Filetype

The small increase in performance you get coding in C++ over C# is hardly enough to offset the headache of coding in the C++ language. ~BoltBait

 

Link to comment
Share on other sites

Do you think that people are interested in such a plugin?

No answers, so I would say it is just me.

Not so fast! I do think this would be very useful and helpful.

I'm particularly interested because pdn does not use CYMK and commercial print shops will often accept an alternative file format of PDF. This plugin would reduce the work required to paste the image into Word and then create a PDF from the document.

I'd be very happy to see this developed.

Link to comment
Share on other sites

You could put the PDF saving in a separate dlls for both x86 and x64 and export the functions you need from the dlls, this is how the WebP file type works.

Then using Pinvoke you can call the exported functions from the dll, determining at runtime what platform you are running under.

Thanks for the hint. I totally forgot about the 64/32 bit issue. So I may have to create a 64bit dll first.

Or is it possible to install Paint.NET 32bit beside of the 64bit verson version? Then I could shift this job.

I created a 64 dummy dll and the communication worked as you explained.

midoras signature.gif

Link to comment
Share on other sites

Not so fast! I do think this would be very useful and helpful.

I'm particularly interested because pdn does not use CYMK and commercial print shops will often accept an alternative file format of PDF. This plugin would reduce the work required to paste the image into Word and then create a PDF from the document.

I'd be very happy to see this developed.

So do you expect that the plugin does color separation? The answer is: No. The only think you may do is to embed a color profile. But Paint.Net does not support this, or?

The first version would just create a flat pdf. This should be easy. To add the layers is a little bit more complex and will take some time.

By the way, In the moment I'm just doing a proof of concept for a pdn2bmp. A little bit tricky to do the deserialization w/o dot net. But it works and I'm just fighting with the implementation of the blend modes to build the composite image. I'm not sure about the math for all blend modes. Any code snippet would be helpful.

midoras signature.gif

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...