Changing page size in runtime
Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Stefan - PDF-XChange
-
guy.marom
- User
- Posts: 98
- Joined: Tue Feb 17, 2009 12:08 pm
Changing page size in runtime
Hello,
I just installed and started testing the PDF-XChange 4 API and I need to be able to change the page size in runtime (And not the sheet size). Is that possible?
Thanks,
Guy Marom
I just installed and started testing the PDF-XChange 4 API and I need to be able to change the page size in runtime (And not the sheet size). Is that possible?
Thanks,
Guy Marom
-
Ivan - Tracker Software
- Site Admin
- Posts: 3603
- Joined: Thu Jul 08, 2004 10:36 pm
Re: Changing page size in runtime
Can you say paper size for any other printer in run-time ? Yes, and you will modify DEVMODE fields to do this. Why you cannot try to do the same with PDF-XChange ?
PDF-XChange Co Ltd. (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.
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.
-
guy.marom
- User
- Posts: 98
- Joined: Tue Feb 17, 2009 12:08 pm
Re: Changing page size in runtime
Could you please direct me to some sample code?
Thanks
Thanks
-
Stefan - PDF-XChange
- Site Admin
- Posts: 19930
- Joined: Mon Jan 12, 2009 8:07 am
Re: Changing page size in runtime
Would this help?
MSDN DEVMODE (This structure contains information about a printer environment and device initialization.)
Regards,
Stefan
MSDN DEVMODE (This structure contains information about a printer environment and device initialization.)
Regards,
Stefan
-
guy.marom
- User
- Posts: 98
- Joined: Tue Feb 17, 2009 12:08 pm
Re: Changing page size in runtime
No sure how to use this, but thank you very much for the help. I really appreciate it.
-
guy.marom
- User
- Posts: 98
- Joined: Tue Feb 17, 2009 12:08 pm
Re: Changing page size in runtime
I found this link and it really helped:
http://www.codeproject.com/KB/dotnet/NE ... brary.aspx
http://www.codeproject.com/KB/dotnet/NE ... brary.aspx
-
John - Tracker Supp
- Site Admin
- Posts: 5225
- Joined: Tue Jun 29, 2004 10:34 am
Re: Changing page size in runtime
Thanks Guy - will FAQ
appreciated.
appreciated.
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.
Best regards
Tracker Support
http://www.tracker-software.com
Best regards
Tracker Support
http://www.tracker-software.com
-
guy.marom
- User
- Posts: 98
- Joined: Tue Feb 17, 2009 12:08 pm
Re: Changing page size in runtime
I'm continuing this thread because I ran into a problem and I think other people might run into the same thing.
I can't seem to find the correct permissions to give the user running my application so that he will be able to change the printer settings. I keep getting a win32exception no. 5 (Access is denied) when I run the win32api method "OpenPrinter".
So far, making the user a local administrator on the machine is the only thing that worked but that's not very good...
Any ideas?
I can't seem to find the correct permissions to give the user running my application so that he will be able to change the printer settings. I keep getting a win32exception no. 5 (Access is denied) when I run the win32api method "OpenPrinter".
So far, making the user a local administrator on the machine is the only thing that worked but that's not very good...
Any ideas?
-
Ivan - Tracker Software
- Site Admin
- Posts: 3603
- Joined: Thu Jul 08, 2004 10:36 pm
Re: Changing page size in runtime
Can you send me you sample code? I will correct it, and send back.
PDF-XChange Co Ltd. (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.
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.
-
guy.marom
- User
- Posts: 98
- Joined: Tue Feb 17, 2009 12:08 pm
Re: Changing page size in runtime
I attached a wrapper class for the WIN32API the problem happens in the function GetPrinterSettings in row no. 184 (The return value in that row is 0, or False).
I attached all of it since it's what I got from the NET, if it's too much I'll try and make a "slimmer" version of the code.
Thanks
I attached all of it since it's what I got from the NET, if it's too much I'll try and make a "slimmer" version of the code.
Thanks
You do not have the required permissions to view the files attached to this post.
-
Ivan - Tracker Software
- Site Admin
- Posts: 3603
- Joined: Thu Jul 08, 2004 10:36 pm
Re: Changing page size in runtime
Sorry, I'm not so familiar with .NET, so, code is a bit ugly. By the way, it works.
You do not have the required permissions to view the files attached to this post.
PDF-XChange Co Ltd. (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.
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.
-
guy.marom
- User
- Posts: 98
- Joined: Tue Feb 17, 2009 12:08 pm
Re: Changing page size in runtime
I know it works, that's why I posted it here in the first place. I'm sure more people can use this.
My problem is with permissions, so far we can't figure out what is the minimal set of permissions needed in order to perform these operations.
We prefer not making the user an administrator for obvious reasons (At least they are obvious to our IT manager
).
I think part of the IT problem is that you printer driver creates temporary printers, so permissions on them cannot be given in advance.
My problem is with permissions, so far we can't figure out what is the minimal set of permissions needed in order to perform these operations.
We prefer not making the user an administrator for obvious reasons (At least they are obvious to our IT manager
I think part of the IT problem is that you printer driver creates temporary printers, so permissions on them cannot be given in advance.
-
Ivan - Tracker Software
- Site Admin
- Posts: 3603
- Joined: Thu Jul 08, 2004 10:36 pm
Re: Changing page size in runtime
Sorry, I didn't understand -- modified example I send you works or not?
PDF-XChange Co Ltd. (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.
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.
-
guy.marom
- User
- Posts: 98
- Joined: Tue Feb 17, 2009 12:08 pm
Re: Changing page size in runtime
Just tested it. It seems to be working fine.
Thank you very much
Thank you very much
-
guy.marom
- User
- Posts: 98
- Joined: Tue Feb 17, 2009 12:08 pm
Re: Changing page size in runtime
I guess I was a bit hasty to rejoice, it doesn't work...
So I dug into the Win32 API (You can find a reference at http://msdn.microsoft.com/en-us/library ... S.85).aspx) and fixed the code.
I used the PRINTER_INFO_9 structure, it is the structure that is used to change user specific printer options.
I noticed that it cannot be populated unless the PDF-XChange printer driver applies settings first - I mean using the ApplyOptions function of the printer driver.
Attached is the final version of the code I am currently using. Enjoy, and again thanks for all the help.
So I dug into the Win32 API (You can find a reference at http://msdn.microsoft.com/en-us/library ... S.85).aspx) and fixed the code.
I used the PRINTER_INFO_9 structure, it is the structure that is used to change user specific printer options.
I noticed that it cannot be populated unless the PDF-XChange printer driver applies settings first - I mean using the ApplyOptions function of the printer driver.
Attached is the final version of the code I am currently using. Enjoy, and again thanks for all the help.
You do not have the required permissions to view the files attached to this post.