howto send host fonts to adobe pdf printer

  • Thread starter Abraham Andres Luna
  • Start date
A

Abraham Andres Luna

hello everyone,

how do i sent the host fonts when i programmatically print to the adobe pdf
printer.

this is my code:

Microsoft.Office.Interop.Excel.Application appExcel = new
Microsoft.Office.Interop.Excel.Application();
appExcel.Workbooks.Open(@"C:\RDK\test.xls", Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing);
Microsoft.Office.Interop.Excel.Worksheet wsFile =
(Microsoft.Office.Interop.Excel.Worksheet)appExcel.Sheets[1];
wsFile.PrintOut(1, 1, 1, false, "Adobe PDF", true, false,
@"C:\RDK\test.pdf"); //this line fails

i get a popup telling me to send the host fonts. the total error message is:

"When you create a PostScript file you have to send the host fonts. Please
go to the printer properties, 'Adobe PDF Settings' page and turn OFF the
option 'Do not send fonts to Distiller'".

thank you for your help.
 
A

Abraham Andres Luna

ok, so i changed the adobe pdf printer preferences under the adobe pdf
settings tab to:
View Adobe PDF results is not checked
Prompt for Adobe PDF filename is not checked
Add Document Information is not checked
Do not send fonts to Adobe PDF is not checked
Delete log files for successful jobs is checked
Ask to Replace existing PDF file is not checked

and now this code works:
Microsoft.Office.Interop.Excel.Application appExcel = new
Microsoft.Office.Interop.Excel.Application();
appExcel.Workbooks.Open(@"C:\RDK\RDK Doc.xls", Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing);
Microsoft.Office.Interop.Excel.Worksheet wsFile =
(Microsoft.Office.Interop.Excel.Worksheet)appExcel.Sheets[1];
wsFile.PrintOut(1, 1, 1, false, "Adobe PDF", false, false, Type.Missing);
appExcel.ThisWorkbook.Close(false, Type.Missing, Type.Missing);
appExcel.Quit();

so this will print the first worksheet of rdkdoc to a pdf without asking for
a filename, etc.

but lets say i have lots of worksheets in the excel file. watch what happens
when i try to print all of them:

Microsoft.Office.Interop.Excel.Application appExcel = new
Microsoft.Office.Interop.Excel.Application();
appExcel.Workbooks.Open(@"C:\RDK\RDK Doc.xls", Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing);
int i = 1;
foreach (Microsoft.Office.Interop.Excel.Worksheet wsPage in appExcel.Sheets)
{
wsPage.PrintOut(1, 1, 1, false, "Adobe PDF", false, false, Type.Missing);
Application.DoEvents();
while (!File.Exists(@"C:\RDK\RDK Doc.pdf"))
{
Thread.Sleep(3000);
}
string strFile = @"C:\RDK\page" + i.ToString() + ".pdf";
File.Delete(strFile);
File.Move(@"C:\RDK\RDK Doc.pdf", strFile);
i++;
}
appExcel.ThisWorkbook.Close(false, Type.Missing, Type.Missing);
appExcel.Quit();

the first worksheet will print fine, but after that, excel starts prompting
me for a filename.
can anyone help with this issue?
 
A

Abraham Andres Luna

the solution works but doesn't make sense.
you have to close the excel file and application then reopen it to print
another worksheet
this will stop the adobe pdf driver from prompting for filename when
printing more than one worksheet.
 
M

Mats Samson

Hello Abraham,
did you make your setting from within Excel Print Properties? That might be
the reason. The trick to get rid of the saving prompt was to change the
printer properties in the Control Panel – Printers and Faxes – Adobe PDF –
Properties – Printing defaults.
You cannot set these properties permanently within the properties in Excel,
as soon you have reset to your Standard Printer the options are selected
again.
Clear the selections for “Prompt for Adobe PDF filename†AND “Do not send
fonts to “Adobe PDFâ€â€. Both are important, the latter for the driver to make
the Postscript files that’ll be deleted after conversion to PDF-files.
Good luck
 

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