Planet PDF Forum Archive

Planet PDF ForumWowsers! This is page is old, head to the LIVE Planet PDF Forum. It features more than 10 conferences, covering everything from beginner to in-depth developer and pre-press discussions. If you wish to continue... one & two archive covers 1999-2011 (160,000 pages).

New Forum | Previous | Next | (P-PDF) Developers

Topic: Suppres Save As printing to distiller
Conf: (P-PDF) Developers, Msg: 136915
From: mintguy
Date: 7/28/2005 12:57 AM

I've written an application in MFC, and I want to be able to programatically convert files produced by this application to PDF. Printing to Distiller works great, but I always get a Save As Box, I want to be able to suppress the box and specifiy the filename programatically using Windows Escape Sequences to the Device context.

I've tried the following code :

#define PDFFILENAME 4312 /* Escape number */
#define DESC_EPDF_PDFFILENAME_UNICODE 5170 /* Escape number */
#define DESC_EPDF_RESET_ALL_KEYVAL 5180 /* Escape number */

/* Return values */
#define PDFINPUT_OK 1
#define PDFINPUT_FAIL -1
#define MAXPATH 256

typedef struct _PDFDocInfo
char title[MAXPATH]; // Title
char author[MAXPATH];
char creationDate[MAXPATH];
char creator[MAXPATH];
char producer[MAXPATH];
char subject[MAXPATH];
char keywords[MAXPATH];
char modDate[MAXPATH];

} PDFDocInfo, *PDFDocInfoPtr;

typedef struct _PDFINPUT
CHAR outputfilename[MAXPATH];
PDFDocInfo docinfo;

typedef struct _PDFDocInfoW {
wchar_t title[MAXPATH]; // Title
wchar_t author[MAXPATH];
wchar_t creationDate[MAXPATH];
wchar_t creator[MAXPATH];
wchar_t producer[MAXPATH];
wchar_t subject[MAXPATH];
wchar_t keywords[MAXPATH];
wchar_t modDate[MAXPATH];

} PDFDocInfoW, *PDFDocInfoPtrW;

typedef struct _PDFINPUTW
wchar_t outputfilename[MAXPATH];
PDFDocInfoW docinfo;

bool CMyViewerView::SendPDFEscSeq(CDC* pDC, const CString& szName)
bool bRetVal = false;

PDFDocInfoW pdfdocinfo;

memset (&pdfdocinfo,0,sizeof(PDFDocInfo));

wcscpy(pdfInput.outputfilename, L"C:\\development\\test1.pdf"/*szName*/);
wcscpy(pdfdocinfo.title, L"New Title");
wcscpy(, L"Gardners Books");
wcscpy(pdfdocinfo.subject, L"My Subject");
wcscpy(pdfdocinfo.keywords, L"PCLViewer file");

pdfInput.docinfo = pdfdocinfo;

int nEscRetVal = pDC->Escape(DESC_EPDF_RESET_ALL_KEYVAL,0,NULL,0,NULL); // must reset first

nEscRetVal = pDC->Escape(DESC_EPDF_PDFFILENAME_UNICODE, sizeof(pdfInput), (LPSTR)&pdfInput, 0,NULL);

if (nEscRetVal == PDFINPUT_OK)
// escape successful
bRetVal = true;
// escape failed
int debug = 1;

return bRetVal;

.. but CDC::Escape() returns 0 which means the escape sequence not supported. Do I have to do anything first to make sure that Distiller will parse the escape sequences. Am I going about this the right way?



PDF In-Depth Free Product Trials Ubiquitous PDF

Debenu Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link...

Download free demo

Debenu PDF Tools Pro

It's simple to use and will let you preview and edit PDF files, it's a Windows application that makes...

Download free demo

Five visions of a PDF Day

In the world of PDFs or as we like to say Planet (of) PDF, a year isn't a real PDF year without an intense few days of industry knowledge sharing.

May 15, 2018
Platinum Sponsor

Search Planet PDF
more searching options...
Planet PDF Newsletter
Most Popular Articles
Featured Product

Debenu PDF Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link control. Take Acrobat to the next level.


Adding a PDF Stamp Comment

OK, so you want to stamp your document. Maybe you need to give reviewers some advice about the document's status or sensitivity. This tip from author Ted Padova demonstrates how to add stamps with the Stamp Tool along with related comments.