PageSizeIndex

PDF-XChange Drivers API (only) V4/V5
This Forum is for the use of Software Developers requiring help and assistance for Tracker Software's PDF-XChange Printer Drivers SDK (only) - VERSION 4 & 5 - Please use the PDF-Tools SDK Forum for Library DLL assistance.

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

jeffp
User
Posts: 923
Joined: Wed Sep 30, 2009 6:53 pm

PageSizeIndex

Post by jeffp »

I'm setting the SheetSizeIndex to -1 like this:

FPDFPrinter.Option['Paper.SheetSizeIndex'] := -1;

However, when I convert a Word doc with a page size of 8.5 x 11.00 the resulting PDF page size is 8.27 x 11.69.

I thought that SheetSizeIndex set to -1 would respect the page size of the source document. How can I ensure I get a 8.5 x 11.00 PDF page size when I convert a Word document of that size?

--Jeff
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19930
Joined: Mon Jan 12, 2009 8:07 am

Re: PageSizeIndex

Post by Stefan - PDF-XChange »

Hi Jeff,

You should specify
FPDFPrinter.Option['Paper.SheetSizeIndex'] := 0
for the Letter / ANSI A size of 8.5'' x 11''

Best,
Stefan
jeffp
User
Posts: 923
Joined: Wed Sep 30, 2009 6:53 pm

Re: PageSizeIndex

Post by jeffp »

I know I can specify 8.5 x 11 by setting the index according. But the issue is a user may have several Word docs to convert, some may be Letter, some may be Landscape, some may be Legal, etc. Is there a way that the PDF driver can set the PDF page size based on the size of the Word doc?

Our app just has the user select a Word doc and the click our convert button. There is no way before hand to know the dimensions of the source document.
jeffp
User
Posts: 923
Joined: Wed Sep 30, 2009 6:53 pm

Re: PageSizeIndex

Post by jeffp »

Also, if I must set the index for this to work, is there a way for me to query the value that is set in the PDF Driver. For example, I can go into Start>>Devices and Drivers and right click the your SDK Driver and see that there is a value set in the Paper section. Is there anyway I can key off this. It looks like the Option property will only allow me to set values not retrieve them.
Walter-Tracker Supp
User
Posts: 381
Joined: Mon Jun 13, 2011 5:10 pm

Re: PageSizeIndex

Post by Walter-Tracker Supp »

Can you provide a sample output PDF to look at? Anything that shows the page size irregularity you speak of. You can either attach it to the forum, or send it to our email (support@pdf-xchange.com).
jeffp
User
Posts: 923
Joined: Wed Sep 30, 2009 6:53 pm

Re: PageSizeIndex

Post by jeffp »

Sure. See the attached zip file. It contains the original Word doc (8.5 x 11 page size) and the resulting PDF (8.27x11.69 page size) after I run it through your SDK Driver. I've also include the portion of my code where I set the Driver's settings.

Also, note that I just created a Word document and set it to Legal or 8.5 x 14. In this case, the resulting PDF matched the Word page size of 8.5 x 14. So it worked in this case.

The user that reported this thinks this didn't happen in prior builds. I wonder if this is a new thing. I'm using build .200.

Code: Select all

function TPDFDriver.InitializePrinter(AFileName: String; APDFMode: Cardinal;
  ACompression: Boolean = True; AEmbedFonts: Boolean = True): Boolean;
var
  i: Integer;
  AVal: OLEVariant;
begin
  Result := False;
  try
    FPDFPrinter.Option['Save.File'] := AFileName;
    FPDFPrinter.Option['Save.SaveType'] := 'Save';
    FPDFPrinter.Option['Save.RunApp'] := False;
    FPDFPrinter.Option['Save.WhenExists'] := 'Overwrite';

    if (APDFMode > 0) then
      FPDFPrinter.Option['General.Specification'] := -1   //PDF/A-1b
    else
      FPDFPrinter.Option['General.Specification'] := 0;


    if (Trim(AFileName) = '') then
      FPDFPrinter.Option['Save.ShowSaveDialog'] := 'Yes'
    else
      FPDFPrinter.Option['Save.ShowSaveDialog'] := 'No';

    //PAGE SIZE
    FPDFPrinter.Option['Paper.SheetSizeIndex'] := -1;

    //COMPRESSION
    if ACompression then
    begin
      FPDFPrinter.Option['Compression.Graphics'] := 'Yes';
      FPDFPrinter.Option['Compression.Text'] := 'Yes';
      FPDFPrinter.Option['Compression.ASCII'] := 'No';
      FPDFPrinter.Option['Compression.Color.Enabled'] := 'Yes';
      FPDFPrinter.Option['Compression.Color.Method'] := 'Auto';
      FPDFPrinter.Option['Compression.Indexed.Enabled'] := 'Yes';
      FPDFPrinter.Option['Compression.Indexed.Method'] := 'Auto';
      FPDFPrinter.Option['Compression.Mono.Enabled'] := 'Yes';
      FPDFPrinter.Option['Compression.Mono.Method'] := 'Auto';
    end else
    begin
      FPDFPrinter.Option['Compression.Graphics'] := 'No';
      FPDFPrinter.Option['Compression.Text'] := 'No';
    end;

    //EMBED FONTS
    FPDFPrinter.Option['Fonts.EmbedAll'] := AEmbedFonts;

    FPDFPrinter.Option['Saver.ShowProgress'] := False;

    FPDFPrinter.ApplyOptions(0);

    Result := True;
  except end;
end;
You do not have the required permissions to view the files attached to this post.
Walter-Tracker Supp
User
Posts: 381
Joined: Mon Jun 13, 2011 5:10 pm

Re: PageSizeIndex

Post by Walter-Tracker Supp »

I have been informed that the issue is that word has an option to automatically resize to letter or A4 depending on your location (e.g. Europe or the Americas). There is a switch somewhere in Word to turn this off; in older versions of office it is under the Print->Options->"Allow A4/Letter resizing" checkbox. I'm currently trying to track it down in office 2010.
Walter-Tracker Supp
User
Posts: 381
Joined: Mon Jun 13, 2011 5:10 pm

Re: PageSizeIndex

Post by Walter-Tracker Supp »

Ah, found it. In Word 2010, go File->Options->Advanced. Scroll down to the "Print" section and uncheck "Scale content for A4 or 8.5x11" paper sizes".
User avatar
Paul - PDF-XChange
Site Admin
Posts: 7441
Joined: Wed Mar 25, 2009 10:37 pm

Re: PageSizeIndex

Post by Paul - PDF-XChange »

Hi Jeff,

Ivan just pointed out to me that Word has a 'special' feature (in all versions) that will force a page to be scaled to either A4 or Letter depending on the user's location. Ivan says you need to ensure your users disable this option:

Image

hth
Best regards

Paul O'Rorke
PDF-XChange Support
http://www.pdf-xchange.com
jeffp
User
Posts: 923
Joined: Wed Sep 30, 2009 6:53 pm

Re: PageSizeIndex

Post by jeffp »

That was it. Why would Word check this by default?

Thanks again.
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19930
Joined: Mon Jan 12, 2009 8:07 am

Re: PageSizeIndex

Post by Stefan - PDF-XChange »

Hi Jeff,

Only MS can answer your last question :)

Cheers,
Stefan