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.

Fri Mar 14, 2014 6:18 pm

I'm evaluating Spire.PDF free edition and found one issue.

When trying to display yours Sample1.pdf file inside a Print Preview Dialog, the pages render with a strange space in the beginning of the file. The code I'm using is this:

var doc = new PdfDocument();
doc.LoadFromFile("Sample1.pdf");
var ppd = new PrintPreviewDialog();
ppd.Document = doc.PrintDocument;
ppd.ShowDialog(this); // renders Image1 attached

I made some tests changing a lot of properties (Margins, PageScaling, OriginAtMargins, etc) and couldn't get it to render the file correctly.

Finally I manage to display the pdf (still incorrectly, but without cropping contents) changing the paper size like this:

var doc = new PdfDocument();
doc.LoadFromFile("Sample1.pdf");
var conv = new PdfUnitConvertor();
var paper = new PaperSize("XX",
(int)Math.Round(conv.ConvertUnits(297, PdfGraphicsUnit.Millimeter, PdfGraphicsUnit.Inch) * 100),
(int)Math.Round(conv.ConvertUnits(420, PdfGraphicsUnit.Millimeter, PdfGraphicsUnit.Inch) * 100));
paper.RawKind = (int)PaperKind.A4;
doc.PrintDocument.DefaultPageSettings.PaperSize = paper;
var ppd = new PrintPreviewDialog();
ppd.Document = doc.PrintDocument;
ppd.ShowDialog(this); // renders Image2 attached

Note that I'm using an A3 size (297 x 420) but the RawKind must be A4. If you change this the rendering problem appears again.

I have also changed the printer to see if this could be related to it, but again with no avail.

When printing the file directly to a printer everything works fine, without the rendering problem.

Probably I'm doing something very silly but I couldn't find out what. I have attached two images displaying what I'm getting.

Additional information:
Spire.PDF version: 2.9.37.56020 Free Edition - .Net Framework 3.5
OSes: Windows XP SP3 32 bits / Windows 7 64 Bits

Can you reproduce this? Do you have any idea why this might be happening?

Best regards and thank you for any help

vladlopes
 
Posts: 1
Joined: Tue Mar 11, 2014 12:31 pm

Mon Mar 17, 2014 3:21 am

Hello,

Sorry for late reply.
Thanks for evaluating our product.
We have reproduced the issue, which has been transferred to our Dev team, once there are any update from them, we will let you know ASAP. Sorry for inconvenience.
If there are any questions, welcome to get it back to us.
Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Thu May 15, 2014 8:11 am

Hello,

Sorry for long silence.
The issue has been resolved, and the newest hotfix of Spire.Pdf has been published, please download and test spire.pdf_hotfix_3.0.27

If there are any questions, welcome to get it back to us.

Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Return to Spire.PDF