Jump to content
Developer Wiki and Function Reference Links Read more... ×
Sign in to follow this  
Frank Schnater

pdf procedures

Recommended Posts

hello all,

for some time I'm trying to find out how the pdf procedures in vectorscript work:

-AcquireExportPDFSettingsAndLocation

-ClosePDFDocument

-ExportPDFPages

-OpenPDFDocument

I tried some things, but nothing happens. The functionreference files are not very instructive.

tia,

Frank Schnater

Share this post


Link to post

They actually work togheter.

I changed them to one procedure for easier use:

PROCEDURE ExportToPDF(pages : DYNARRAY of STRING; inSeparateDocuments : BOOLEAN);
VAR
	currentPage, pageResult : INTEGER;
	firstPage, lastPage : INTEGER;
	firstBook, lastBook : INTEGER;
	activeLayer : HANDLE;

BEGIN
	IF AcquireExportPDFSettingsAndLocation(inSeparateDocuments) THEN BEGIN
		activeLayer := ActLayer;
		GetArrayDimensions(pages, firstPage, lastPage, firstBook, lastBook);
		IF inSeparateDocuments THEN BEGIN
			FOR currentPage := firstPage TO lastPage DO BEGIN
				IF OpenPDFDocument(pages[currentPage]) THEN BEGIN
					Layer(pages[currentPage]);
					pageResult := ExportPDFPages(pages[currentPage]);
					ClosePDFDocument;
				END;
			END;
		END ELSE BEGIN
			IF OpenPDFDocument('') THEN BEGIN
				FOR currentPage := firstPage TO lastPage DO BEGIN
					IF GetLayerByName(pages[currentPage]) <> NIL THEN BEGIN
						Layer(pages[currentPage]);
						pageResult := ExportPDFPages(pages[currentPage]);
					END;
				END;
				ClosePDFDocument;
			END;
		END;
		Layer(GetLName(activeLayer));
	END;
END;

The pages variable is an array of layer names.

Share this post


Link to post

Is it possible to choose the PDF name beforehand ?

I tried it by changing the following:

IF OpenPDFDocument(customnamehere?.pdf) THEN

But that ain't the way

Share this post


Link to post
Is it possible to choose the PDF name beforehand ?

I tried it by changing the following:

IF OpenPDFDocument(customnamehere?.pdf) THEN

But that ain't the way

Your name must be a string, so enclose it with '

And I think that ? will not work in a filename.

Edited by DWorks

Share this post


Link to post

Yeah I did that, this wasn't my source code so it actually was ('filename.pdf'), yet it keeps using the active vw document name

Edited by hippothamus

Share this post


Link to post
It could be a bug. I did this a long time ago and do not remember having that issue.

If its a bug its in version 2010,2011 and 2013.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×