OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > Corel Photo-Paint VBA

Thread Tools Search this Thread Display Modes
Old 15-12-2006, 18:04
Posts: n/a
Default Help with ActiveDocument.PublishToPDF

Hey all:

I'm using PP 12 and I would like to write a VBA macro to dump the currently open set of documents to a PDF. Yes, I know about the File|Publish to PDF menu pick. However, when the PDF file dialog opens, the file order depends upon the order of how PP opens the files (I don't want to open them one at a time, there are too many). Often, the order PP opens the files is not the page order I want in the PDF document. I want to open the files programmatically, in the order I want, and then push them all to a multiple page PDF document.

I can dump a single file to a PDF using the ActiveDocument.PublishToPDF method. However, unlike Corel Draw, documents in Photo-Paint do not have multiple pages (not a movie either!). When I try setting the PublishRange to pdfPageRange, (and set the PageRange to a CSV list of the open file names), VB chokes and complains: Run-time error '-2147467259(800004005)': Method 'PublishToPDF' of object IPaintDocument' failed. This is so even if I use a page range like: "1-5" for example.

Here's some code:
'** This works for the active document **
Sub DumpPDF()
With ActiveDocument.PDFSettings
' .PublishRange = pdfPageRange
' .PageRange = "<opened filename1>, <opened filename2>, etc"
End With
ActiveDocument.PublishToPDF ("<path>\test.pdf")
End Sub

If I enable the PublishRange and PageRange lines, I get the error described above.

Somehow, PP does a multi-document dump to a single PDF file. How can I do this too?

Thanks in advance!
Bubbler Pipe

Last edited by pbisson; 27-08-2011 at 08:08.
Reply With Quote
Old 15-12-2006, 21:33
Michael Cervantes
Posts: n/a
Default List box

You could create a list box to open the files in the order you please.

Reply With Quote
Old 16-12-2006, 13:24
Posts: n/a

I'm not interested in how to make the list of files, that's not the problem. I'm interested in how to make .PublishToPDF dump multiple PP documents to a single, multi-page PDF file. I don't want to bring up the PDF dialog box and interact with the user.

Somehow PP allows the user to dump multiple docs to a single PDF through the File|Publish To PDF menu pick, and I'd like to do that programmatically.

Sorry for the confusion
Nightdreams Live

Last edited by pbisson; 27-08-2011 at 08:09.
Reply With Quote
Old 18-12-2006, 13:33
Alex's Avatar
Alex Alex is offline
Join Date: Nov 2002
Posts: 1,940
Blog Entries: 4

Well, I guess you can't. Same with multi-document output from CorelDRAW. It's not available through automation...
Reply With Quote
Old 20-12-2006, 18:22
wOxxOm's Avatar
wOxxOm wOxxOm is offline
Senior Member
Join Date: Mar 2005
Posts: 836

Use pdf.join utility, there are also command-line versions available, some of them free.
Reply With Quote
Old 03-01-2007, 21:37
Posts: n/a

OK, thanks everyone for your help. I'll use an external utility to join the PP generated PDF's.
buy a condo in Pattaya

Last edited by pbisson; 27-08-2011 at 08:09.
Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -5. The time now is 17:28.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com