How to get transparent background png from PDF document in C#?

back to home  >  Tech FAQ  >  Convert PDF to transparent background png in C#

Question:

Hi,support, I'm using your .net PDF converter to convert PDF pages to images now. I have a question about your PDF library, can I get a png file with transparent background from PDF? If possible, how can I do? Is there some special property or API?

---- Dunn

Answer:

Hi, Dunn.

The pqScan .net PDF to image SDK can convert PDF page to png format. The whole png background and foreground color is depending on the PDF page graphics. In the PDF document, if the page back color is transparent, our .net PDF converter will render output png with transparent background.

In PDF viewers, the back fill color always is white. Sometimes you may feel in some PDF page, the font is black color, and the background is transparent, so the output png file should be transparent background. But actually, the background of PDF page is white color, so the converted png file is not transparent.

If there are some pictures in the PDF page, which the pictures maybe transparent image. While converting, our .net PDF to image converter can render to transparent graphics to the output png file.

And there isn't any other special property or methods to create transparent png image. Please look at the following C# example code, it's just the same as converting PDF to other image formats(jpeg, tiff, bmp, gif).

PDFDocument doc = new PDFDocument();
doc.LoadPDF("sample.pdf");

Bitmap bmp = doc.ToImage(0);
bmp.Save("transparent.jpg");

Hope the C# code can be helpful.

---- pqScan Support Team

Online Demo Download Trial Problem with converting PDF to image in Mac. How to use .NET PDF converter in Mono? Can .net PDF to image converter integrate to Windows7 or Windows8? Can I Get a Compression Jpeg Image from PDF ? How to convert PDF to high quality image in C#? How to get transparent background png from PDF document in C#? Support Converting specific pages from PDF to images in C# .NET ? Converting specific languagePDF to images is possible? Is convert special page size PDF to image possible? Converting specific style PDF to images is allowed?