The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Export Graphs as MultiPage PDF
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Mulvenna

Germany
46 Posts

Posted - 11/13/2013 :  03:35:35 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. 8.6
Operating System: Windows 7

Hi,

I was wondering is it possible to export multiple graphs to a multipage PDF document?

I can only find the X-Function to export a worksheet in this format.

At the minute my script outputs about 40 PDFs, it would be amazing if I could combine these into about 3 or 4 documents instead.

Regards,
Conor

greg

USA
1379 Posts

Posted - 11/13/2013 :  12:37:52 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
We do not have this option yet, but it's not that difficult to do...

Copy all your graphs to a new folder. (Unless they already are all in one folder and there are no other graphs.)
Open a new Workbook and Maximize it.
Delete the second column and resize the column width to fill the workbook.
Remove the Long Name, Units and Comments Header rows.
Set the number of rows to the number of graphs. (e.g. wks.nrows = 40;)
Select all these rows.
Drag the row separator between row 1 and 2 down until the one cell fills the workbook.
Now run this script:
// BEGIN SCRIPT
row = 1;
doc -ef P {
insertGraph gname:=%H
embed:=0
resizecell:=0
axes:=0
cell:=[Book2]1!1[row:row];
row++;
}
// END SCRIPT
(Be sure to change "[Book2]" to be the name of your new book.)

That creates large links to your graphs in each cell. Now you can use the Export as MultiPage PDF option (expPDFw X-Function) to create a single, multipage PDF.
Go to Top of Page

Mulvenna

Germany
46 Posts

Posted - 11/14/2013 :  02:49:10 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks Greg that works great.

Just one question though, is there any way to set the margin to 0? Each page of the PDF has a margin added to all sides. It's slightly better when I use "keepAspect=0" when inserting the graph but its still squashed down a little on export.

Not a huge problem obviously but would be nice to have the original size.

Thanks again for the help.
Mulvenna
Go to Top of Page

Mulvenna

Germany
46 Posts

Posted - 11/14/2013 :  06:23:28 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Ok, I found how to do it but I can't seem to get it to do exactly what I want, could someone (greg) :P help me out with what Im doing wrong please?

expPDFw path:=%Y01_Technology_Testing\ filename:="%(tr$)_%(date$)_%(PDFname$)" overwrite:=replace tr2.MultiPage.Pagination.Top:=2. tr3.UseOwn:=0. tr3.Check.Chk_Frame:=0. tr3.Margin.Top:=0. tr3.Margin.Bottom:=0. tr3.Margin.Left:=0. tr3.Margin.Right:=0.;

Everything works fine except the tree node options. Basically I want it to have:

No Frame;
No margins at all!;
Page Numbers in the top right corner.
Go to Top of Page

greg

USA
1379 Posts

Posted - 11/15/2013 :  12:23:43 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I am not sure where you were getting your tr3 properties from, but they do not match the expPDFw tr3 properties. Oddly, Origin does not complain and creates the PDF anyway.

I am not sure any of the settings will get you the margin you require.

You can use the following procedure and script to manually tweak the cell sizes to get what you want:

Turn on Page Break Preview Lines ( under the View menu ) so you get indicator of where Page Breaks occur.
Select all rows (do not include header, do not select whole worksheet).
Resize the first row just enough so that a page break occurs between row 1 and row 2. (This can be difficult to see since the selection is all black, but when you when you get to the right size, a dashed, blue line will appear at the bottom of row1.)
Here's the trick to sizing the column:
If you size the column smaller, the graph (eventually) starts to shrink.
If you size the column larger, the graph (eventually) stops getting larger and instead starts shifting to the right.
You want your column size to be at the 'magic' point at which this change takes place.

Assuming you have assigned values to tr$, date$ and PDFname$, then this script should do it:

strPath$ = "%Y01_Technology_Testing\";
strFile$ = "%(tr$)_%(date$)_%(PDFname$)";
expPDFw path:=strpath$
filename:=strfile$
overwrite:=rename
tr3.UseOwn:=0.
tr3.Check.Chk_Frame:=0.;
Go to Top of Page

Mulvenna

Germany
46 Posts

Posted - 11/19/2013 :  06:07:58 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks greg, I have it working great. Just wondering are the options on this page not available? This is where I found the margin options:

http://www.originlab.de/www/helponline/Origin/en/programming/mergedProjects/X-Function/X-Function/ExpPDFw.html
Go to Top of Page

greg

USA
1379 Posts

Posted - 11/19/2013 :  10:34:03 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Those options do not appear in either the dialog, nor in the self-documenting help:
exppdfw -h
so it looks like they are just not working. You can try the
tr3.useown:=1
option and use Page Setup to set the margins. Most printers ( whose properties Origin references when rendering a page ) have some minimum margin so you may find those values do not 'stick'. Depending on printer setup, you may find you cannot even enter a margin of 0.
Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 11/20/2013 :  10:13:38 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Just an additional info for people who come by this thread,

As an easy work-around, you can send the graphs in your project or in a folder to PowerPoint (by right-clicking the folder in the Project Explorer), which opens it automatically, then you can save the PP slides to a PDF file. Though this may be less fine controllable than scripting, you can at least control the margins when you send graphs to PP.

--Hideo Fujii
OriginLab

Edited by - Hideo Fujii on 11/20/2013 10:14:28 AM
Go to Top of Page

Castiel

343 Posts

Posted - 11/20/2013 :  11:51:23 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I use Ghostscript to merge PDFs. First, list all PDFs to be merged, for example
dir /B *.pdf>pdflist.txt

Then execute a command like
gswin32c -o merged.pdf -sDEVICE=pdfwrite -dNOPAUSE -dBATCH Graph1.pdf Graph2.pdf Graph3.pdf


The PDF Origin exports seems to be PDF-1.2. I've been thinking about parsing them with Origin C and then merging them. It may be nothing more than correcting obj's offset and index and updating the xref part...anyway, Ghostscript works.

妾+   午旦  妹罕妾  妾伊    用仇  妾/     岫ㄞ
 妾京用 仍巨  件 侈   件戶' 甘岫平   /欠  白岫妹
   併             艮          岫  奈 白   岫
                              岫
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000