Error while convert to PDF

  • Thread starter vs.parthasarathy
  • Start date
V

vs.parthasarathy

Hi,

I am trying to convert a visio drawing file to pdf programmatically(C+
+)
using Document::printOut method.

If the parameter "Print to File" is set to false then it is working
fine, but the problem is, it pops up the dialog box to specify the
target file, so I passed false to "Print to File" parameter and gave
the file location in the "OutputFilename" parameter now it is giving
an error "When you create a PostScript file you have to send the host
fonts". I tried using some other pdf printer, but it didn't generate
the pdf properly.


Code snippet:


_bstr_t OutputFileName("c:\\drawing1.pdf");
_bstr_t SourceFileName("C:\\Drawing1.vsd");
_bstr_t bsPrinter("Adobe PDF");

Visio::IVDocumentPtr doc = vApp->Documents->Open(SourceFileName);
vApp->ActiveDocument->PrintOut(Visio::visPrintAll, 1, 1,
VARIANT_TRUE,
bsPrinter,
VARIANT_TRUE, OutputFileName, 1, VARIANT_TRUE,
VARIANT_FALSE);


I have Visio 2003 & SP3

I want to use the PrintOut method to silently convert to pdf without
prompting for any dialog boxes. Please give me some idea on how to
resolve this.

Thanks,
VSP
 
C

Chris Roth [Visio MVP]

Hi VSP,

Which version of Visio are you using? Visio 2007 has a PDF print option
(you have to download it from MS)

Then you have the doc.ExportAsFixedFormat method that can be used to
create PDFs (or XPS format as well)

Might be easier.

Otherwise, you might check out the AlertResponse method. It helps you to
deal with dialogs over which Visio has little control (ie: filters and such)

--
Hope this helps,

Chris Roth
Visio MVP


Visio Guy: Smart Graphics for Visual People

Articles: http://www.visguy.com
Shapes: http://www.visguy.com/shapes
Dev: http://www.visguy.com/category/development/
Forum: http://www.viguy.com/vgforum
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top