Manually setting Print.ScaleType to ReduceToMargins broke?

PDF-XChange Viewer SDK for Developer's
(ActiveX and Simple DLL Versions)

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

DSSavant
User
Posts: 216
Joined: Thu Jul 08, 2004 7:29 pm

Manually setting Print.ScaleType to ReduceToMargins broke?

Post by DSSavant »

I searched the forum and found a similar post but there was no resolution given:

https://forum.pdf-xchange.com/ ... ins#p23971

The issue in a nutshell is that if I manually set all of the print options up and then print without the UI, not all options will be honored. The biggest problem being ReduceToMargins.

I have reproduced the problem using the C# Full Demo code. Inside the routine "private void b_Print_Click(object sender, EventArgs e)", I have added the following code right before the call to print the document:

Code: Select all

try
{
	// Start of my code
	axCoPDFXCview1.SetProperty("Print.ScaleSimple.AutoRotate", 1);
	axCoPDFXCview1.SetProperty("Print.ScaleSimple.AutoCentre", 1);
	axCoPDFXCview1.SetProperty("Print.Copies", 1);
	axCoPDFXCview1.SetProperty("Print.Collate", 1);
	axCoPDFXCview1.SetProperty("Print.PrintSpec", "DocumentAndMarkups");
	axCoPDFXCview1.SetProperty("Print.NotesAndPopups", 1);
	axCoPDFXCview1.SetProperty("Print.ScaleType", "ReduceToMargins");
	// End of my code

	axCoPDFXCview1.PrintDocument(nActiveDocID, (int)PXCVA_Flags.PXCVA_NoUI);
}
catch (Exception ex)
{
    ShowErrorMessage(System.Runtime.InteropServices.Marshal.GetHRForException(ex));
}

I'm using the attached PDF called TallForm.PDF. Its dimensions are 8.27 X 11.69 inches. Yep, it is a Tall Form.

--When printed interactively with the Printer UI showing, everything works great!
--When printed Without UI, no scaling occurs and the bottom of the page is truncated on the printed page.

Viewer version is 2.5.195.
Win7, 64-bit.
FullDemo compiled as 32-bit app not that it should matter.
You do not have the required permissions to view the files attached to this post.
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2445
Joined: Thu Jun 30, 2005 4:11 pm

Re: Manually setting Print.ScaleType to ReduceToMargins brok

Post by Vasyl - PDF-XChange »

Hi, DSSavant.

I tried to reproduce problem with latest version from official site, using your code, in C#/C++ examples, but I couldn't - all works correctly, no any page truncation...

Please check again version of SDK, in full demo, display menu bar and look to About, version should be 2.5.195.

Best
Regards.
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
DSSavant
User
Posts: 216
Joined: Thu Jul 08, 2004 7:29 pm

Re: Manually setting Print.ScaleType to ReduceToMargins brok

Post by DSSavant »

I've attached a ZIP file with pretty pictures that will show the problem. Please refer to the file. Also, please use the original PDF when trying to reproduce the problem.

FWIW, I'm on a brand new machine therefore there is no "old" versions of your product on it, etc. I'm on the most recent.

Scream if I can help further.
You do not have the required permissions to view the files attached to this post.
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2445
Joined: Thu Jun 30, 2005 4:11 pm

Re: Manually setting Print.ScaleType to ReduceToMargins brok

Post by Vasyl - PDF-XChange »

Hi, DSSavant.

We still cannot reproduce the problem :(
Please tell us:

1. Maybe you have used the special NoApply flag? For example:
axCoPDFXCview1.SetProperty("Print.ScaleType", "ReduceToMargins", (int)PXCVA_Flags.PXCVA_NoApply);

- do not use it or apply cached changes before changing these properties:
axCoPDFXCview1.ApplyAllCachedChanges();
...
SetPropety("Print.ScaleType", ...)

2. What is target printer exactly?

3. Can you try any of our other examples: C++, VB6, VB.NET, etc. to reproduce this problem?

4. Try to obtain the actual value of "Print.ScaleType" property after changing. The actual value should be new.

Best
Regards.
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
DSSavant
User
Posts: 216
Joined: Thu Jul 08, 2004 7:29 pm

Re: Manually setting Print.ScaleType to ReduceToMargins brok

Post by DSSavant »

Vasyl,

I created a very simple project that reproduces the problem. It is attached. Please unzip and review. The code I listed above is all that I'm using to reproduce the problem. Below is the dumbed down version of the code. There is nothing special here.

When you run the project please be sure to use the PDF file I have included in prior ZIP files.

My tested printers are:
- HP LaserJet 1020
- Lexmark T520
- HP LaserJetP2050 PCL6

Code: Select all

using System;
using System.Windows.Forms;
using PDFXCviewAxLib;

namespace DumbedWayDownBug
{
	public partial class Form1 : Form
	{
		private int _activeDocumentId = 0;

		public Form1() 
		{
			InitializeComponent();
		}

		private void _loadFile_Click(object sender, EventArgs e)
		{
			axCoPDFXCview1.OpenDocument("C:\\temp\\TallPaper.PDF");
			axCoPDFXCview1.GetActiveDocument(out _activeDocumentId);
		}

		private void _printBug_Click(object sender, EventArgs e)
		{
			try
			{
				// Added the following line to help Tracker reproduce the problem.
				axCoPDFXCview1.ApplyAllCachedChanges();

				// Start of original code that breaks.
				axCoPDFXCview1.SetProperty("Print.ScaleSimple.AutoRotate", 1);
				axCoPDFXCview1.SetProperty("Print.ScaleSimple.AutoCentre", 1);
				axCoPDFXCview1.SetProperty("Print.Copies", 1);
				axCoPDFXCview1.SetProperty("Print.Collate", 1);
				axCoPDFXCview1.SetProperty("Print.PrintSpec", "DocumentAndMarkups");
				axCoPDFXCview1.SetProperty("Print.NotesAndPopups", 1);
				axCoPDFXCview1.SetProperty("Print.ScaleType", "ReduceToMargins");

				// Lets see if our stuff was actuall set.
				object dataout;
				axCoPDFXCview1.GetProperty("Print.ScaleType", out dataout);	// should be 2 and it is

				axCoPDFXCview1.PrintDocument(_activeDocumentId, (int)PXCVA_Flags.PXCVA_NoUI);

				axCoPDFXCview1.GetProperty("Print.ScaleType", out dataout);	// should be 2 and it is
			}
			catch (Exception ex)
			{
				return;
			}
		}
	}
}
You do not have the required permissions to view the files attached to this post.
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2445
Joined: Thu Jun 30, 2005 4:11 pm

Re: Manually setting Print.ScaleType to ReduceToMargins brok

Post by Vasyl - PDF-XChange »

Hi, DSSavant.

We have found one problem and will fix it the new build.
Currently to solve this problem use one workaround - add before printing:

Code: Select all

axCoPDFXCview1.SetProperty("Print.PaperName", "");
axCoPDFXCview1.SetProperty("Print.PaperWidth", 0);
axCoPDFXCview1.SetProperty("Print.PaperHeight", 0);
- after this the our control will use the default printer's paper forcedly...

HTH.
PDF-XChange Co. LTD (Project Developer)

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
DSSavant
User
Posts: 216
Joined: Thu Jul 08, 2004 7:29 pm

Re: Manually setting Print.ScaleType to ReduceToMargins brok

Post by DSSavant »

Many thanks!
User avatar
John - Tracker Supp
Site Admin
Posts: 5223
Joined: Tue Jun 29, 2004 10:34 am

Re: Manually setting Print.ScaleType to ReduceToMargins brok

Post by John - Tracker Supp »

;-)
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