日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

USE PDFCREATE TO CREATE A PDF FILE

發布時間:2023/12/13 编程问答 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 USE PDFCREATE TO CREATE A PDF FILE 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

來源:http://www.pdfforge.org/files/old_forum/1002.html

a working sample with C++ & COM

2007-08-15 22:56:18 by eckart

hi,?

here is a working sample of how to use PDFCreator in Visual C++ (after searching on internet for something similar I guess this is the only sample)?

This sample is reading c:\2.txt file and output to c:\pdf\2.pdf?

1. you need to #import 1?

#import "C:\WINDOWS\system32\MSVBVM60.DLL" rename ( "EOF", "VBEOF" ), rename ( "RGB", "VBRGB" ) //if you don't use this you will be in BIG trouble?
#import "C:\Program Files\PDFCreator\PDFCreator.exe"?


2. start your PDF engine?

::CoInitialize(NULL);?
CComPtr<pdfcreator::_clspdfcreator>?pdfObject;?
HRESULT hr = pdfObject.CoCreateInstance(L"PDFCreator.clsPDFCreator");?

if (!FAILED(hr))?
{?

if (pdfObject->cStart(L"/NoProcessingAtStartup", FALSE)==FALSE)?
{?
AfxMessageBox("can't start printer");?
return;?
};?

PDFCreator::_clsPDFCreatorOptionsPtr opt= pdfObject->GetcOptions();?
opt->PutUseAutosave(1);?
opt->PutUseAutosaveDirectory(1);?
opt->PutAutosaveDirectory(L"c:\\pdf\\"); //here you put your output folder?
opt->PutAutosaveFormat(0); //0 for PDF?
opt->PutAutosaveFilename(L"2.pdf"); //pdf output file name?

pdfObject->PutRefcOptions(opt);?
pdfObject->PutcDefaultPrinter(L"PDFCreator"); //use PDFCreator printer from ControlPanel->Printers?

pdfObject->cClearCache();?
//pdfObject->cSaveOptions(L"1");?
pdfObject->PutcPrinterStop(VARIANT_FALSE); //let's start with PDFCreator Printer Process Queue ON?
pdfObject->cPrintFile(L"c:\\2.txt"); //input of the file that will be translated into PDF format?
Sleep(4000); //lets wait for processing, TODO implement __clsPDFCreator_eReadyEventHandler?
BSTR fn = pdfObject->GetcOutputFilename(); //if your PDFCreator Printer is OFF you will get nothing ""?
AfxMessageBox(CString((const wchar_t*)fn));?

pdfObject->cClose();?
}?

pdfObject.Release();?

//--------------------------------

*tada*?

if this sample is not working I guess is not my fault ;-)?

thanks,?
--adi?

adrian.paleacu[a]gmail.[0m?


?

2008-12-16 10:56:50 by hwewet

Hi!

This sample works fine, but is it possible to do this
without the #import instructions ???
by the way, i dont want use the *.tlh *.tli files of course!

轉載于:https://www.cnblogs.com/songtzu/p/3523154.html

創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎

總結

以上是生活随笔為你收集整理的USE PDFCREATE TO CREATE A PDF FILE的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。