How to center the print result when using AcutalSize

Technical support for Spire.PDF

Moderator: iceblue support

How to center the print result when using AcutalSize

Postby InfraTec » Tue Jul 18, 2017 7:42 am

Hi Support Team,

I have to use the Property PdfPrintPageScaling.ActualSize when printing PDFs. But when using this Option with the actual Version of spire.pdf (3.9) the print result ist shifted and not centered at the page.

With an older Version of the spire.pdf (3.2) what i was using before the print result was centered at the page.

Which Parameter I have to set to get the printed page centered when using the ActualSize Property?

best regards,
Jens
InfraTec
 
Posts: 2
Joined: Fri Jun 16, 2017 12:51 pm

Re: How to center the print result when using AcutalSize

Postby Jane.Bai » Tue Jul 18, 2017 10:13 am

Hello,

Thanks for your inquiry.
Our dev team has made some modifications on the PageScaling property, at present, when you set it as ActualSize, the the print result will lay on the top left rather than center. If you want to get approach to it, you have to do a calculation and see the margin. Never mind, I have added it as a new feature into our schedule. Once there's any progress, I will let you know. Below is the code for margin setting.
Code: Select all
PdfDocument doc = new PdfDocument();
            doc.LoadFromFile(filepath);
            doc.CustomHandleLandscape = true;
            doc.PrintDocument.DefaultPageSettings.Margins = new Margins(150, 150, 150, 150);
            doc.PrintDocument.OriginAtMargins = true;
            doc.PrintDocument.DefaultPageSettings.Landscape = false;
            doc.PageScaling = PdfPrintPageScaling.ActualSize;
            doc.PrintDocument.Print();


Sincerely,
Jane
E-iceblue support team
User avatar
Jane.Bai
 
Posts: 276
Joined: Tue Nov 29, 2016 1:47 am

Re: How to center the print result when using AcutalSize

Postby InfraTec » Tue Jul 18, 2017 12:19 pm

Hello Jane,

thanks a lot for the quick reply.

With your code I got the x-direction shift working, but for y-direction it's not working. It doesn't matter what values I set for margins.top or margins.bottom, the print result is not shifted for y-direction.

Do you have any other ideas to resolve my printing Problem?

best regards,
Jens
InfraTec
 
Posts: 2
Joined: Fri Jun 16, 2017 12:51 pm

Re: How to center the print result when using AcutalSize

Postby Betsy.jiang » Wed Jul 19, 2017 2:58 am

Dear Jens,

Thanks for your feedback.
Sorry that we didn't encounter the issue you mentioned with the latest Spire.PDF Pack(Hot Fix) Version:3.9.189. Please try to use this version firstly. If the issue still happens, please share us the input file and the code you were using for testing.

Many thanks,
Betsy
E-iceblue support team
User avatar
Betsy.jiang
 
Posts: 1321
Joined: Tue Sep 06, 2016 8:30 am

Re: How to center the print result when using AcutalSize

Postby Jane.Bai » Thu Jul 20, 2017 7:14 am

Hello Jens,

To put the print result in the center, you could take the following code as a temporary workaround. Make sure you are using the latest version Spire.Pdf3.9.226.
Code: Select all
PdfDocument doc = new PdfDocument();
            doc.LoadFromFile(filepath);
            doc.PageScaling = PdfPrintPageScaling.CustomSacle;
            doc.PrintDocument.Print();

As for the new feature, when it is finished, I will let you know.

Sincerely,
Jane
E-iceblue support team
User avatar
Jane.Bai
 
Posts: 276
Joined: Tue Nov 29, 2016 1:47 am

Re: How to center the print result when using AcutalSize

Postby Jane.Bai » Thu Jul 27, 2017 8:39 am

Hello,

Did the temporary workaround I provided make sense? Could you please give us some feedback at you convenience?

Sincerely,
Jane
E-iceblue support team
User avatar
Jane.Bai
 
Posts: 276
Joined: Tue Nov 29, 2016 1:47 am


Return to Spire.PDF

Who is online

Users browsing this forum: No registered users and 0 guests