Save Visio drawing with embedded object as a PDF, and have the object clickable

Started by Hey Ken, February 15, 2017, 05:42:17 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Hey Ken

Folks:

   Okay, here's another odd one out on the edge of Visio.

   I have a Visio drawing with an embedded file: a spreadsheet, a Word document, whatever.  Doesn't matter what kind of file; I can be flexible about it.  Double-click on the embedded file in Visio and it opens no problem.  However, when I save the drawing as a PDF, the embedded file is just an icon.  Clicking on it does nothing.

   The question is: How can I save a Visio diagram as a PDF and still have the embedded object clickable and openable?  My research so far indicates it can't be done.

   Yes, I could use a PDF editor and manually add the embedded file in post-production, but you know me – hate to have too many keystrokes or too much trouble.  And the Visio in question already has a dozen embedded files, and I'm expecting to add more.

   Yes, I could hyperlink to the embedded document rather than embed it, but I expect the final PDF to be distributed far and wide.  That means I'd need to distribute over a dozen files (clunky) or store the embedded files in some central location (don't have one everyone can access).

   Any suggestions?

   - Ken


Ken V. Krawchuk
Author
No Dogs on Mars - A Starship Story
http://astarshipstory.com

Yacine

May be a little bit naive, but Nikolay  published some days ago a SVG publishing tool. Wouldn't this be a solution?
Yacine

Hey Ken

Yacine:

   No, Nikolay's tool is not an option, sorry to say.  HTML saved from Visio tends to be HUGE, which makes it very difficult if not impossible to e-mail, even when zipped.  And my drawings tend to be huge in the first place, even in native Visio.  Plus, embedding a dozen+ files would only make things worse.  Apparently I'm my own worst enemy. 

   Thanks for the thought, though.

   - Ken

Ken V. Krawchuk
Author
No Dogs on Mars - A Starship Story
http://astarshipstory.com

wapperdude

So, can I call you Ken Luthor, son of Lex.    ;D::)

This might be a pdf issue.  When you think about it, an Excel table / worksheet in Visio must leverage certain Excel features.  Basically, it pushes into Excel (Excel Object model) to invoke Excel window & editing features.  I don't think a pdf has that ability.  Just a guess.

But, you might want to check Excel forums re embedding worksheet into pdf, and perhaps external pdf generating apps.

Wapperdude
Visio 2019 Pro

metuemre

You may think about attaching embedded files to pdf. I attached a sample .vsd file with an embedded excel file.

AttachToPdf macro in the visio exports the embedded excel file to the same path with visio file, then saves the visio file as pdf, then attaches exported excel file to the generated pdf file.

References to Acrobat and Excel are needed in vba.

If the exported excel file is empty, you need to double click on the embedded excel file, then click on visio again to refresh the excel  before running the macro.

More info on adobe acrobat can be found on following links;
http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/iac_api_reference.pdf
http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/iac_developer_guide.pdf


Yacine

Very cool.
Made however crash my Excel.
Also could not find a way to get the attachment to open on double click.
Still very nice.
Yacine

metuemre

My test configuration is Visio 2013 and Excel 2007 32bit.

There are 2 ways to attach file to a pdf file. First one is to attach to document, second one is to attach as comment or annotation. I implemented the first way but second way can be more appropriate for Ken's needs since a comment box can be created and placed on corresponding page of pdf for each embedded files in visio and user can double click to open the attachment.

There are examples in acrobat api on how to create new annotation and set its properties.

Nikolay

Quote from: metuemre on February 17, 2017, 02:52:24 PM
You may think about attaching embedded files to pdf. I attached a sample .vsd file with an embedded excel file.

AttachToPdf macro in the visio exports the embedded excel file to the same path with visio file, then saves the visio file as pdf, then attaches exported excel file to the generated pdf file.

References to Acrobat and Excel are needed in vba.

If the exported excel file is empty, you need to double click on the embedded excel file, then click on visio again to refresh the excel  before running the macro.

More info on adobe acrobat can be found on following links;
http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/iac_api_reference.pdf
http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/iac_developer_guide.pdf

It's really interesting. Maybe you could share the produced PDF so that we can understand better what the result is?
I could not make the macro run.. it says that "Acrobat.CAcroApp" is not defined. Where this object is coming from?
Do I need to install something (beside Visio and Acrobat Reader)?

wapperdude

Haven't tried, so, excuse the ignorance, but I think it requires Acrobat, not the reader.  That limits applicability, at least for creating the pdf.  It would seem the double click to open Excel is iffy.

2nd, and now for my fuzzy memory, but, when I embed a worksheet into Visio, it's a stand-alone object.  I can distribute without including the Excel file.  That's Ken's 2nd requirement.  This avoids dispatching a myriad of files.

From my perspective, I'd want both capabilities...double click, no attachments.

I think it really comes down to Adobe vs MS and doing it their way.   Hmmm, I feel like singing.   ;D

Wapperdude





Visio 2019 Pro

Yacine

Yes you do need the Acrobat, not just the reader.
Here's an example of a PDF with attachments on the drawing itself
Yacine

Yacine

@Hey Ken,
Back to your argument about the size. I used Nikolay's tool to export a 8.5 MB vsd to html. The exported file has only 3.5 MB. Almost 1/3 of the original size.
Yacine

Hey Ken

   Finally found some time to get back to this.  Several show-stoppers, sad to say.

   First, Metuemre's solution does indeed require Acrobat—which we don't have here.  That ends that story.

   Next, I downloaded Nikolay's SVG's export, and I encountered numerous problems:
   1.   It costs money.  But I wouldn't mind forking over the $40 if it solved my problem.  Unfortunately, it does not.
   2.   It's sloooooooooow.  A minute or two per page times 200 pages in my Visio equals a looooooooong time.
   3.   The converted file is HUGE!  It's only half done the conversion (tired of waiting, so I'm typing), and already it's well over 30 meg.  Zipping got it down to 20 meg, still too large.  Can't e-mail something that large, especially when the corresponding PDF is less than 10 meg (and only a single file).  FYI, the original .vsdx is 18 meg using Visio 2013 professional.
   4.   The conversion crashed 2/3 of the way through.  The error said, "The 'g' start tag on line 2746 position 5 does not match the end tag of 'svg', Line 2799, position 3."  Indeed.
   5.   I tried it with a smaller file and it worked fine, except that the HTML only works when the files live in the My Documents folder.  More precisely, I could not get them to work if I copied the files to another folder.
   6.   Size wise, the HTML it generated was about the same size as what Visio did.

   So I'm back where I started.  My provisional solution is to send the attachments as separate files zipped together with the PDF, then hyperlink to them from within the PDF.  Not the exact answer I was looking for, but it is an answer.

   Thanks for the help, as always.

   - Ken Luthor

Ken V. Krawchuk
Author
No Dogs on Mars - A Starship Story
http://astarshipstory.com

wapperdude

I don't have a anything to add or be of help, just wanted to LOL at how you tagged the end.   ;)

Wapperdude
Visio 2019 Pro

Nikolay

Hi Ken, thank you for the feedback!  Just to address some points :)

Quote1. It costs money.  But I wouldn't mind forking over the $40 if it solved my problem.  Unfortunately, it does not.

For companies. I think it's kind of fair. Please also note that exporting large diagrams with embedded documents for sending them later by email was not actually an  anticipated use case :)

Quote2. It's sloooooooooow.  A minute or two per page times 200 pages in my Visio equals a looooooooong time.

It's true, unfortunately it's not blazing-fast, especially if you have 200 pages :)
I'm trying to make it faster, but it doesn't only depend on the extension, also on Visio itself..

Quote3. The converted file is HUGE!  It's only half done the conversion (tired of waiting, so I'm typing), and already it's well over 30 meg. 
Zipping got it down to 20 meg, still too large.  Can't e-mail something that large, especially when the corresponding PDF is less than 10 meg (and only a single file).  FYI, the original .vsdx is 18 meg using Visio 2013 professional.

It's plain HTML after all.. Normally it's not less than original. I think .svgz can be an option, but that's basically just zipping svg file, and it'll come back to something as big as .vsdx

Quote
4.   The conversion crashed 2/3 of the way through.  The error said, "The 'g' start tag on line 2746 position 5 does not match the end tag of 'svg', Line 2799, position 3."  Indeed.

That sounds like a bug. If you could send me the file (I can sign NDA, if required), I would be really grateful!
This week I'll release update 1.1, hopefully it'll be fixed there.
Quote5. tried it with a smaller file and it worked fine, except that the HTML only works when the files live in the My Documents folder.  More precisely, I could not get them to work if I copied the files to another folder.

By exporting, it also creates by default one support folder called "vp", that contains about 5 support javascript files (not to duplicate them for every diagram), depending on the options (it's quite small actually). One can either specify different path directly in the export dialog, then this folder will be created in the export location, or copy that folder along, that should do it.
Quote
6.   Size wise, the HTML it generated was about the same size as what Visio did.
Yes, that's how it is.. I think HTML can be smaller in some specific cases, but normally it's expected to be larger.
Quote
So I'm back where I started.  My provisional solution is to send the attachments as separate files zipped together with the PDF, then hyperlink to them from within the PDF.  Not the exact answer I was looking for, but it is an answer.
Yes, your point is valid - how to distribute large diagram with embedded files in one piece, while keeping the links working..
The idea of both html export, and SharePoint Visio Services actually is that you don't send files by email,
but distribute a link to those files, stored on your company's server or in the cloud.

vojo

Did you try, imbed a link in visio for the icon of PDF (PDF icon in a group).
So you double click the pdf group shape (eventdoubleclick) ...launches the PDF

I bit manual...3-4 steps....but I don't think it will be too bad

Of course, you could write a VBA to do this.