IPXCPrinter->Paper.Margin?

A forum for questions or concerns related to the PDF-XChange Core API SDK

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
sabio5
User
Posts: 16
Joined: Thu Apr 24, 2008 6:49 pm

IPXCPrinter->Paper.Margin?

Post by sabio5 »

When upgrading from version 5 to version 9, I notice that the default paper margins have disappeared from the PDFs generated by my application and the printable area of the paper is correspondingly larger. In other words, by default, the V5 interface assumed unprintable margin areas of about 5 mm, whereas the V9 interface apparently assumes no margin. For my application this is resulting in various compatibility problems. Although the margin can be set in the interactive driver Preference dialog, this is not practical for the application to rely on. Is there a way to configure the margins through the API?

It looks like nearly all of the settings available in the Preferences dialog are available via the IPXCPrinter properties, except margin. LeftPos and TopPos are similar, but don't seem to affect the right and bottom edge.

Thanks
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3549
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: IPXCPrinter->Paper.Margin?

Post by Ivan - Tracker Software »

Margins always were set to 0 by default. I wonder how you get 5 mm.
It looks like nearly all of the settings available in the Preferences dialog are available via the IPXCPrinter properties, except margin. LeftPos and TopPos are similar, but don't seem to affect the right and bottom edge.
The LeftPos and TopPos parameters are not margins. They define the position of a printed page on the sheet.

To set up margins, you need to set "Paper.Margin" value in a tenth of mm.
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
sabio5
User
Posts: 16
Joined: Thu Apr 24, 2008 6:49 pm

Re: IPXCPrinter->Paper.Margin?

Post by sabio5 »

Hmmm....

I don't see Paper.Margin in the SDK documentation anywhere. But more importantly, it doesn't seem to have any effect. Here's my code...

Code: Select all

m_pPrinter->Option[L"Paper.Margin"] = 50;

It doesn't throw an error, so appears to be recognized as a valid property, but the output is still right up against the edge of the page.

By comparison, LeftPos does work ...

Code: Select all

m_pPrinter->Option[L"Paper.LeftPos"] = 50;

... but as you say, it's not the same as margin!
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3549
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: IPXCPrinter->Paper.Margin?

Post by Ivan - Tracker Software »

Can you please send me a piece of code when you configure the printer?
And, the code where you print, if you do not print with an external app (like Word, etc.) - you need to use GetDeviceCaps(PHYSICALOFFSETX) and GetDeviceCaps(PHYSICALOFFSETY) to take margins into account.

You can use ivan@tracker-software.com to send your code.

Merry Christmas and Happy New Year :)
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
sabio5
User
Posts: 16
Joined: Thu Apr 24, 2008 6:49 pm

Re: IPXCPrinter->Paper.Margin?

Post by sabio5 »

Sending a piece of code is more complicated than it sounds due to the complexity of our application (We started with the PDFX3 version, which was a completely different architecture, so there are now multiple layers of wrappers.) Instead I tried working with the CExAPI sample (even though it targets version 7 rather than the current 9) and discovered that the Paper.Margin does indeed work, but only if executed prior to creating the Device Context. Which is understandable, although several, if not most, of the other properties do seem to take effect even after the Device Context has been created or reset, leading me miss the connection. (Our application, which was originally modeled on the PDFX3 interface, works by interpreting PDFX directives inserted into the source document as it is being rendered to the device context, so it's not as weird as it may otherwise seem to set properties after the DC has been generated.)

It probably would be very helpful if the documentation indicated which properties had to be set before the creation of the DC (and if it even mentioned Paper.Margin), but now that I understand the issue, I've been able to work around the issue by pre-scanning the source document for property settings that need to be done prior to the DC creation. And am happy to report that my PDFX9 output now matches the PDFX5. I'm still looking forward to the 9.2.360 update to fix the Paper.SheetSizeIndex issue, but I can get by with the custom size workaround for that, at least in the short term. So I'm ready to start celebrating!

Thank you and Happy New Year!
User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8371
Joined: Wed Jan 03, 2018 6:52 pm

IPXCPrinter->Paper.Margin?

Post by TrackerSupp-Daniel »

:)
Dan McIntyre - Support Technician
Tracker Software Products (Canada) LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
Post Reply