TrimBox

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

relapse
User
Posts: 167
Joined: Wed Jan 18, 2012 11:10 am

TrimBox

Post by relapse »

Hello! Executing my function with these commands deletes white space! Why?

Code: Select all

string result = string.Empty;
string jscript = "this.getPageBox(\"Trim\", this.pageNum);";
try
{
    pdfViewer.RunJavaScript(javascript, out result, _documentId, 0);
}
//...
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19885
Joined: Mon Jan 12, 2009 8:07 am

Re: TrimBox

Post by Stefan - PDF-XChange »

Hello relapse,

Seems like you are using the wrong JS :)

string result = string.Empty;
string jscript = "this.getPageBox(\"Trim\", this.pageNum);";
try
{
pdfViewer.RunJavaScript(javascript, out result, _documentId, 0);
}
//...

Best,
Stefan
relapse
User
Posts: 167
Joined: Wed Jan 18, 2012 11:10 am

Re: TrimBox

Post by relapse »

I had edited the code extraction a little bit (certainly only in browser :D ) before I posted it. The problem remains.

Code: Select all

string result = string.Empty;
string jscript = "this.getPageBox(\"Trim\", this.pageNum);";
try
{
    pdfViewer.RunJavaScript(jscript, out result, _documentId, 0);
}
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19885
Joined: Mon Jan 12, 2009 8:07 am

Re: TrimBox

Post by Stefan - PDF-XChange »

Hello relapse,

Just tested this code (C#) - and it does work as expected - giving me the Trim box values, and not deleting any white space. I worked with the Full Demo sample project and in single file mode - hence the 0 for documentID.

Code: Select all

 string bsResult = "";
 string jscript = "this.getPageBox(\"Trim\", this.pageNum);";
 try
 {
     axCoPDFXCview1.RunJavaScript(jscript, out bsResult, 0, 0);
 }
 catch (Exception ex)
 {
     ShowErrorMessage(System.Runtime.InteropServices.Marshal.GetHRForException(ex));
 }
 t_Jresult.Text = bsResult;
Best,
Stefan
relapse
User
Posts: 167
Joined: Wed Jan 18, 2012 11:10 am

Re: TrimBox

Post by relapse »

Additional description:

- I have your pdf viewer AX in my program.
- I load a pdf into the pdf viewer.
- I execute the javascript command (see my first post in this thread).
- The pdf viewer automatically deletes the whitespace.
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19885
Joined: Mon Jan 12, 2009 8:07 am

Re: TrimBox

Post by Stefan - PDF-XChange »

Hello relapse,

My sample application is doing the same:
- loads the AX control
- then I open a file inside it
- execute the JS code just as you provided it
- and it returns the expected string, and no white space is removed.

Please double check your code and see if you are not performing additional operations on the same file which could cause this white space removal.

I also tried the JS in the end user viewer - and it's behaving properly there as well.

I also presume that you have double checked and confirmed that you are using build 201.

Best,
Stefan
relapse
User
Posts: 167
Joined: Wed Jan 18, 2012 11:10 am

Re: TrimBox

Post by relapse »

It's woodoo :shock:

I've checked it twice and thrice and found it as a command in a branched function among code which was commented out. I'm very sorry for this awkwardness :oops: :oops: :oops:

But... what is with my thread about Tools.Active.ZoomIn?
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19885
Joined: Mon Jan 12, 2009 8:07 am

Re: TrimBox

Post by Stefan - PDF-XChange »

Hi Relapse,

Glad to hear that you found the villain - even if it was not supposed to be executing.

Will check that other topic now.

Best,
Stefan
Tracker