Questions about programmatic PDF printing from MFC CHtmlView, convert from CHtmlView to PDF file, print from CHtmlView to PDF file

Hello,

My company is currently considering evaluating your Document Printer SDK. Before we download the evaluation version, could you please answer the following questions:

1) Our app is built on MFC using C++. Would your SDK allow us to take a page that's contained in an CHtmlView, and then save it as a PDF?
2) If so, could you please provide sample code that would accomplish this?
3) What is the license for your SDK? Does it conform to a standard license, or is it custom?

Thank you for your help,
Customer
-----------------------------------------------
>>1) Our app is built on MFC using C++. Would your SDK allow us to take a
page that's contained in an CHtmlView, and then save it as a PDF?

Yes, you can print from CHtmlView to docPrint PDF Driver and save to PDF file easily. You can also save to a HTML file first, and then call doc2pdf.exe to convert this HTML file to PDF file.

>>2) If so, could you please provide sample code that would accomplish this?

You can save HTML contents from CHtmlView to a temporary HTML file first, call following command line to convert this HTML file to PDF file,

"C:\Program Files (x86)\docPrint Pro v6.0\doc2pdf.exe" -i D:\test.html -o D:\out.pdf

after conversion is finished, you can delete temporary HTML file from your system.

>>3) What is the license for your SDK? Does it conform to a standard license or is it custom?

You can purchase "Document Printer SDK (docPrint SDK) Developer License $1500.00" from following web page,

https://www.verypdf.com/app/document-converter/try-and-buy.html

after you purchased Developer License, you can integrate it into your application and redistribute it to your customers royalty free.

VeryPDF
-----------------------------------------------
Thanks for the response. I have some additional questions:

1) It's great to hear that I can print an html page using the command line. Can I also print in code, using the CHtmlView directly? If so, will you be able to provide sample code for this?

2) Does the PDF creation (for my case above) allow the addition of security features, such as restricting print in the resulting PDF file? Does this work both in code, and also via command line with doc2pdf.exe?

Thanks again,
Customer
-----------------------------------------------
>>1) It's great to hear that I can print an html page using the command line.
>>Can I also print in code, using the CHtmlView directly? If so, will you
>>be able to provide sample code for this?

Yes, you can, but you need set output filename to registry first, please refer to following VB code, you can port it to VC++ code easily.

docPrint PDF Driver can be controlled from following item in registry,

HKEY_CURRENT_USER\Software\verypdf\pdfcamp

You can set "AutomaticDirectory" to output filename, here is a VB function,

Private Sub SetOutputFileName_docPrintPDFDriver(ByVal strOutputFile As String)
SaveStringLong HKEY_CURRENT_USER, "Software\verypdf\pdfcamp", "AutomaticOutput", 1
SaveStringLong HKEY_CURRENT_USER, "Software\verypdf\pdfcamp", "AutomaticValue", 2
SaveStringLong HKEY_CURRENT_USER, "Software\verypdf\pdfcamp", "AutoView", 0

'SaveStringLong HKEY_CURRENT_USER, "Software\verypdf\pdfcamp", "EmbedNum", 0
SaveStringLong HKEY_CURRENT_USER, "Software\verypdf\pdfcamp", "Unit", 3

SaveStringLong HKEY_CURRENT_USER, "Software\verypdf\pdfcamp", "PageSelect", 10
SaveStringLong HKEY_CURRENT_USER, "Software\verypdf\pdfcamp", "PageSize", 7

SaveStringLong HKEY_CURRENT_USER, "Software\verypdf\pdfcamp", "Bitcount", 1
SaveStringLong HKEY_CURRENT_USER, "Software\verypdf\pdfcamp", "xResolution", 300
SaveStringLong HKEY_CURRENT_USER, "Software\verypdf\pdfcamp", "yResolution", 300
SaveStringLong HKEY_CURRENT_USER, "Software\verypdf\pdfcamp", "PageW", 0
SaveStringLong HKEY_CURRENT_USER, "Software\verypdf\pdfcamp", "PageH", 0

SaveString HKEY_CURRENT_USER, "Software\verypdf\pdfcamp", "AutomaticDirectory", strOutputFile
End Sub

after that, you can call printing function in CHtmlView and print to docPrint PDF Driver, then you will get an output PDF file properly.

>>2) Does the PDF creation (for my case above) allow the addition of security
>>features, such as restricting print in the resulting PDF file? Does this
>>work both in code, and also via command line with doc2pdf.exe?

Yes, docPrint SDK does support encryption function, but this function is supported in command line version only, here are some options for PDF encryption,

-s openpwd=XXX : set 'open password' to PDF file
-s ownerpwd=XXX : set 'owner password' to PDF file
-s keylen=XXX : key length (40 or 128 bit)
-s keylen=0 : 40 bit RC4 encryption (Acrobat 3 or higher)
-s keylen=1 : 128 bit RC4 encryption (Acrobat 5 or higher)
-s keylen=2 : 128 bit RC4 encryption (Acrobat 6 or higher)
-s permission=XXX : set permission to PDF file
-s permission=0 : Encrypt the file only
-s permission=3900 : Deny anything
-s permission=4 : Deny printing
-s permission=8 : Deny modification of contents
-s permission=16 : Deny copying of contents
-s permission=32 : No commenting
===128 bit encryption only -> ignored if 40 bit encryption is used
-s permission=256 : Deny FillInFormFields
-s permission=512 : Deny ExtractObj
-s permission=1024 : Deny Assemble
-s permission=2048 : Disable high res. printing
-s permission=4096 : Do not encrypt metadata
===Other utility options===

You can run command lines to convert HTML file to PDF file and add security settings to output PDF files,

"C:\Program Files (x86)\docPrint Pro v6.0\doc2pdf.exe" -s openpwd=123 -s ownerpwd=456 -s keylen=0 -s permission=3900 -i C:\test.html -o C:\out.pdf

"C:\Program Files (x86)\docPrint Pro v6.0\doc2pdf.exe" -s ownerpwd=456 -s keylen=2 -s permission=3900 -i C:\test.html -o C:\out.pdf

VeryPDF

See Also:

https://www.verypdf.com/wordpress/201106/pdfcamp-batch-printing-21.html

https://www.verypdf.com/wordpress/201106/print-to-pdfcamp-printer-without-save-as-dialog-in-64bit-system-666.html

https://www.verypdf.com/wordpress/201110/registration-problem-to-docprint-pro-sdk-product-8273.html

https://www.verypdf.com/wordpress/201106/set-output-file-name-and-path-for-docprint-pdf-driver-779.html

https://www.verypdf.com/wordpress/201107/verypdf-docprint-support-how-to-set-output-pdf-file-name-1611.html

https://www.verypdf.com/wordpress/201201/pdfcamp-printer-x64-erase-the-registry-settings-20897.html

https://www.verypdf.com/wordpress/201108/pdfcamp-printer-v2-3-wont-install-on-64-bit-windows-7-system-1934.html

VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *


Verify Code   If you cannot see the CheckCode image,please refresh the page again!