JavaScript for Acrobat - which properties supports PDF-XCh.

The PDF-XChange Viewer for End Users
+++ FREE +++

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

vasssek
User
Posts: 4
Joined: Tue May 31, 2011 5:11 am

JavaScript for Acrobat - which properties supports PDF-XCh.

Post by vasssek »

Good morning,

We use in our company for opening pdf files your perfect product PDF-XChange Viewer 2.5 (build 195).

In my web application I generate programatically pdf file (via Telerik Reporting dlls) and then it's embedd into web page through this:

Code: Select all

<object><embed width="100%" type="application/pdf" id="pdfObject" runat="Server"></embed></object>
The problem is that I need to set some javascript properties from JavaScript for Acrobat standard:
1st - add print preview on pdf file open - this property works properly with PDF-Xchange Viewer

2nd - change zoom value (decrease to e.g. 70%) on initial opening of pdf file: this.zoom=70;
- this works just in Adobe Acrobat Reder, but not in PDX-Xchange Viewer :cry:

Here is the C# code declaration which I use:

Code: Select all

Hashtable deviceInfo = new Hashtable();
    deviceInfo["JavaScript"] = "this.print({bUI: true, bSilent: true, bShrinkToFit: true});this.zoom=70;";
 
    ReportProcessor reportProcessor = new ReportProcessor();
    RenderingResult result = reportProcessor.RenderReport("PDF", reportToExport, deviceInfo);
I wonder If you could give me info which javascript properties from JavaScript for Acrobat are supported by PDF-XChange Viewer.

It would be perfect If PDF-XChange Viewer can accept this.zoom property. Of course there are other javascript properties which will be fine if your product supports them (zoomtype.fitP;zoomtype.fitW;zoomtype.fitH, etc.)

I've attached an example file which has set property this.zoom=10;

Please help me to solve this issue.

Best regards

Vasssek
You do not have the required permissions to view the files attached to this post.
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19930
Joined: Mon Jan 12, 2009 8:07 am

Re: JavaScript for Acrobat - which properties supports PDF-X

Post by Stefan - PDF-XChange »

Hello vasssek,

We do support most of the properties in the JS API Reference and are constantly working on supporting the few left that we still do not.

Zoom is in th elist of supported ones already. (I tested in the end user viewer through the JS console and it worked as expected).

I think it is the sequence in which you are attempting to execute those - the print before the zoom and with UI for the printing process. If you reverse the order of the commands - the document will be zoomed to the desired percentage first, and then the Printing process will start.

We just ran a small test with one of our sample applications, and it launched the Print dialogue just as expected, and after closing that - the zoom was set to the correct value. (We might have an issue with bShrinkToFit which should set the PageScale to "Reduce to Printer Margins" - but we will check that separately)

Best,
Stefan
vasssek
User
Posts: 4
Joined: Tue May 31, 2011 5:11 am

Re: JavaScript for Acrobat - which properties supports PDF-X

Post by vasssek »

Good morning,

I've followed your advice and generate pdf report file with just zoom property.

Code: Select all

Hashtable deviceInfo = new Hashtable();
deviceInfo["JavaScript"] = "this.zoom=70;";
Unfortunately it doesn't work either. For your convenience I've attached generated sample pdf file, which when is opened by PDF-Xchange Viewer (Free edition) is not zoomed out at all (still on 100% :twisted: ). But when I open it through Adobe Reader X, the file is zoomed out on 70% as I requested.

In the attachment there is also one zipped .wmv video file, which describes the steps I've done.

Please help me to solve this issue.

Kind Regards

Vasssek
You do not have the required permissions to view the files attached to this post.
User avatar
Vasyl - PDF-XChange
Site Admin
Posts: 2476
Joined: Thu Jun 30, 2005 4:11 pm

Re: JavaScript for Acrobat - which properties supports PDF-X

Post by Vasyl - PDF-XChange »

Hi, vasssek.
For your convenience I've attached generated sample pdf file, which when is opened by PDF-Xchange Viewer (Free edition) is not zoomed out at all (still on 100%)
You are right - here is bug, we will fix it in the next build. Thanks for report.
As workaround, try to use other way to set initial zoom: the pdf-document can contain the special list of document open actions.
Look to PDFReference v1.7, pg #140., [Root/OpenAction] array or dictionary.

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.
vasssek
User
Posts: 4
Joined: Tue May 31, 2011 5:11 am

Re: JavaScript for Acrobat - which properties supports PDF-X

Post by vasssek »

Good morning,

After reading PDFReference v1.7, I've found there some example:

This example shows the use of an auto state array with usage application dictionaries. The AS entry in
the default configuration dictionary is an array of three usage application dictionaries, one for each of the
Event values View, Print, and Export.


/OCProperties % OCProperties dictionary in document catalog
<< /OCGs [1 0 R 2 0 R 3 0 R 4 0 R]
/D << /BaseState /OFF % The default configuration
/ON [1 0 R]
/AS [ % Auto state array of usage application dictionaries
<< /Event /View /Category [/Zoom] /OCGs [1 0 R 2 0 R 3 0 R 4 0 R] >>
<< /Event /Print /Category [/Print] /OCGs [4 0 R] >>
<< /Event /Export /Category [/Export] /OCGs [3 0 R 4 0 R] >>
]
>>
>>
...

1 0 obj
<< /Type /OCG
/Name (20000 foot view)
/Usage << /Zoom << /max 1.0 >> >>
>>
endobj
2 0 obj
<< /Type /OCG

, but I still don't know how to transform it to C#, respectively javascript form, so then it could by applied to pdf generation section as I wrote in my previous response ...

Could you please help me with this issue ? If it isn't possible, I have another question.

When will be released a new software version (build) with zoom fix ?

Best regards

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

Re: JavaScript for Acrobat - which properties supports PDF-X

Post by Stefan - PDF-XChange »

Hello vasssek,

We need the attention of one of our developers that is in the Canadian office, so he will reply a bit later to this topic.

And for the new build - I do not have any exact information but we usually release new builds ever 4-6 weeks.

Best,
Stefan
User avatar
John - Tracker Supp
Site Admin
Posts: 5225
Joined: Tue Jun 29, 2004 10:34 am

Re: JavaScript for Acrobat - which properties supports PDF-X

Post by John - Tracker Supp »

Also - please be advised the end user version is neither licensed or designed to allow direct developer use or interaction - for this you must use our developer kits.

If you are not - please be advised - you would be breaching the end user license to pursue this and we will not assist or in any way support your use of this.

Can you advise if you are using a developer SDK or not - and if you are - we will move this to the developer forum.

Thanks.
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
vasssek
User
Posts: 4
Joined: Tue May 31, 2011 5:11 am

Re: JavaScript for Acrobat - which properties supports PDF-X

Post by vasssek »

Good morning,

thank you for this information.

It seems that I'd better wait for the next build release, where the javascript zoom functionality on pdf file open should work as it's expected...

Have a nice day.

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

Re: JavaScript for Acrobat - which properties supports PDF-X

Post by Stefan - PDF-XChange »

Hi Vasssek,

Yes it would be best to wait for the next build.

You too have a lovely day!
Stefan