Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Tue Jun 13, 2017 9:05 pm

Hello,

I have an application that creates pdfs with background images and adds in text dynamically. When generating the PDF everything looks as it should, but when we SaveAsImage in the cases of large pdfs/images the background becomes pixelated.

For example:
Source image: chapterweb.net/test-source.jpg
Spire.PDF Ouput PDF: chapterweb.net/test.pdf
Spire.PDF SaveAsImage Output: chapterweb.net/test-output.jpg

The snip of code that converts the pdf to image is the following:
using (System.IO.MemoryStream mem = new System.IO.MemoryStream())
{
using (Image img = doc.SaveAsImage(0, Spire.Pdf.Graphics.PdfImageType.Bitmap, 150, 150)
{
doc.Close();
img.Save(mem, System.Drawing.Imaging.ImageFormat.Jpeg);
}
mem.Position = 0;
return mem.ToArray();
}

Currently using Spire.PDF version 3.8.22 with a license.

Thank you.

jsilva101
 
Posts: 3
Joined: Mon Oct 13, 2014 4:27 pm

Wed Jun 14, 2017 3:28 am

Hello,

Thanks for your inquiry.
Concerning your case, I suggest you first using our latest hot fix(Spire.PDF Pack(Hot Fix) Version:3.9.141) to have a try. If the issue still troubles you, please send your sample files to us via email(support@e-iceblue.com). We would investigate it and provide a solution accordingly.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Return to Spire.PDF