question about "NewDocumentFromImages"

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

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Post Reply
rho123456
User
Posts: 6
Joined: Mon Jul 22, 2013 2:32 pm

question about "NewDocumentFromImages"

Post by rho123456 »

Trying to import some images into a new pdf doc with the following vb6 codes:

...
...

Dim args As Variant
Dim arr(1) As Variant
Dim vDataOut as Variant

arr(0) = ".\image1.bmp"
arr(1) = ".\image2.bmp"

args = arr

Call PdfAX.DoVerb(Null, "NewDocumentFromImages", args, vDataOut, 0)

...
...

I always got Type mismatch error when calling the .DoVerb command. Can you show me how to make such call correctly?

Thanks and regards
Ray
Nico - Tracker Supp
User
Posts: 205
Joined: Fri May 18, 2012 8:41 pm

Re: question about "NewDocumentFromImages"

Post by Nico - Tracker Supp »

Hi rho123456,

Thank you for your post.
The command "NewDocumentFromImages" allows you to access the UI dialog to select the pictures you need for your new PDF document.
Pictures cannot be added programmatically but through the UI dialog.
The command can be called as follows:
//pseudo-code
DoVerb(NULL, "ExecuteCommand", 36375, vDataOut, 0);
Thanks.
Sincerely,
mcsi
User
Posts: 3
Joined: Mon Mar 19, 2012 3:55 am

Re: question about "NewDocumentFromImages"

Post by mcsi »

I can actually import the graphics file by using "newdocumentfromimages" command. But my problem is that the image file size is defaulted to A4, not Letter. I tried to set "Operations.Newdocument.FromImages.Paper.PaperWidth" to 612 and "...PaperHeight" to 792, but could not get anyway. The new document refused to change its size (A4, 8.27x11.69). The imported image gets scaled down. Any ideas to resolve my problem?
Thanks in advance.
Nico - Tracker Supp
User
Posts: 205
Joined: Fri May 18, 2012 8:41 pm

Re: question about "NewDocumentFromImages"

Post by Nico - Tracker Supp »

Hi mcsi,

Thanks for your post.
If you use PaperHeight and PaperWidth properties, you also need to set PaperMode property in Custom mode (which is numerical value zero)
Please take a look at page 209 from the PDF-XChange Viewer ActiveX manual (PDFV_AX.pdf).
Thanks.

Sincerely,
Nico - Tracker Supp
User
Posts: 205
Joined: Fri May 18, 2012 8:41 pm

Re: question about "NewDocumentFromImages"

Post by Nico - Tracker Supp »

Another alternative consists in setting PaperName property to "Letter/ANSI A" and PaperMode to numerical value one (standard mode).
Supported values for PaperName property follow:
"A0",
"A1",
"A2",
"A3",
"A4",
"A5",
"B0",
"B1",
"B2",
"B4",
"B5",
"Letter/ANSI A",
"Tabloid/ANSI B",
"ANSI Super B",
"ANSI C",
"ANSI D",
"ANSI E",
"ANSI F",
"US Legal",
"Statement",
"Executive",
"Folio",
"Quarto",
"Note",
"Envelope #9",
"Envelope #10",
"Envelope #11",
"Envelope #14",
"Envelope DL",
"Envelope C5",
"Envelope C3",
"Envelope C4",
"Envelope C6",
"Envelope C65",
"Envelope B4",
"Envelope B5",
"Envelope B6",
"Env. Monarch",
"Env. Personal",
"18x24",
"24x36",
"30x42",
Thanks.
Sincerely,
mcsi
User
Posts: 3
Joined: Mon Mar 19, 2012 3:55 am

Re: question about "NewDocumentFromImages"

Post by mcsi »

Thank you so much for your timely and right on target responses. I got it working!
The trick is the proper string, i.e., "Letter/ANSI A". I was trying just "letter" with various casing (upper or lower) for the ".PaperName" for quite some time. But everything time it crashes the program. I wish the list you provided had been in the manual. I was looking all over for it, but could not find it anywhere. Yes, make sure do the ".PaperMode" first. Then do ".PaperName". That will get you the right paper size (Letter 8.5x11, yes, I am an American). One more trick though. Make sure the margins of the new document (".MarginLeft",".MarginRight",".MarginTop", ".MarginBottom") are all set to 0. If you don't, the imported image will be scaled down after it was brought in. Do all the above, and then .DoVerb(0, "NewDocumentFromImages", vDataIn, vDataOut, 0). Assign your image file to "vDataIn" before the .DoVerb, of course, if it is a single file. With multiple files, you will need to use .Args. I have not tried it myself. You can play with it and figure it out. Thanks again, Nico. That's it!
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17906
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: question about "NewDocumentFromImages"

Post by Tracker Supp-Stefan »

Glad you got it working mcsi,

I believe this list is available e.g. in our Drivers API manual, but I will make a note to the person responsible so that that list is included in the Viewer SDK one as well.

Regards,
Stefan
mcsi
User
Posts: 3
Joined: Mon Mar 19, 2012 3:55 am

Re: question about "NewDocumentFromImages"

Post by mcsi »

Drivers API manual is apparently no longer distributed with the install file. Looks like it is online only. Not very convenient. I started with API functions with my app development. Then after I did the upgrade of the viewer AX to 2.5, the API V4 does not work any more. So I decided to consolidate the code by using the viewer functions only. That's how I got into experimenting with the "NewDocumentFromImages". Thanks for considering the addition of the list to the viewer manual.
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17906
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: question about "NewDocumentFromImages"

Post by Tracker Supp-Stefan »

:)
User avatar
Chris - Tracker Supp
Site Admin
Posts: 797
Joined: Tue Apr 14, 2009 11:33 pm

Re: question about "NewDocumentFromImages"

Post by Chris - Tracker Supp »

Hi mcsi,

IT has taken several months to get our end user and developer manuals into the new online format, which will have a link to a downloadable PDF version of said manuals in the near future.

Best,
Chris
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.


Chris Attrell
Tracker Sales & Support North America
http://www.tracker-software.com
Post Reply