How to convert HTML files to PDF files and use PDF Split-Merge COM/SDK to split and merge PDF files?

Hello,

1) Please provide instructions on licensing the PDF Split-Merge COM/SDK
2) Please provide instruction on using it within our ASPX environment

Customer
-------------------------------------------------------
>>1) Please provide instructions on licensing the PDF Split-Merge COM/SDK

http://www.verypdf.com/app/pdf-split-merge/try-and-buy.html#buy-sdk

You can use following sample code to register PDF Split-Merge SDK product,

C++ Example,
==========================================
void main()
{
BOOL bRet = FALSE;
char szInPDF[MAX_PATH];
GetModulePath(szInPDF, "testcmd.pdf");
PDF_SetCode("XXXXXXXXXXXXXXXXXXXX");

char szOutPDF1[MAX_PATH];
char szOutPDF2[MAX_PATH];
char szOutPDF3[MAX_PATH];
GetModulePath(szOutPDF1, "out-001.pdf");
GetModulePath(szOutPDF2, "out-002.pdf");
GetModulePath(szOutPDF3, "out-003.pdf");

HPDF hPDF = PDF_Open(szInPDF);
bRet = PDF_ExtractPages(hPDF, szOutPDF1, "1-3");
bRet = PDF_ExtractPages(hPDF, szOutPDF2, "2-6");
bRet = PDF_ExtractPages(hPDF, szOutPDF3, "10");
PDF_Close(hPDF);

char szMergePDFs[2048];
strcpy(szMergePDFs, szOutPDF1);
strcat(szMergePDFs, "|");
strcat(szMergePDFs, szOutPDF2);
strcat(szMergePDFs, "|");
strcat(szMergePDFs, szOutPDF3);
char szOutMergedPDF[MAX_PATH];
GetModulePath(szOutMergedPDF, "merged1.pdf");
bRet = PDF_MergePDFFiles(szMergePDFs, szOutMergedPDF);

GetModulePath(szOutMergedPDF, "merged2.pdf");
sprintf(szMergePDFs, "%s*1,2,3,8-10", szInPDF);
bRet = PDF_MergePDFFiles(szMergePDFs, szOutMergedPDF);
}
==========================================
C# Example,
==========================================
private void button2_Click(object sender, EventArgs e)
{
string appPath = Path.GetDirectoryName(Application.ExecutablePath);
System.Type VeryPDFSplitMergeCOMType = System.Type.GetTypeFromProgID("VeryPDFSplitMergeCOM.com");
VeryPDFSplitMergeCOM.com VeryPDFSplitMergeCOM = (VeryPDFSplitMergeCOM.com)System.Activator.CreateInstance(VeryPDFSplitMergeCOMType);

VeryPDFSplitMergeCOM.com_PDF_SetCode("XXXXXXXXXXXXXXXXXXXXXXXXXXX");

string szPDFFile = appPath + "\\testcmd.pdf";
VeryPDFSplitMergeCOM.com_VerySplitMergePDFEx(szPDFFile, "2-5", appPath + "\\_page2-5.pdf");
int nPageCount = VeryPDFSplitMergeCOM.com_VeryGetPDFFilePageCount(appPath + "\\_page2-5.pdf");
MessageBox.Show(appPath + "\\_page2-5.pdf" + " is contain " + nPageCount.ToString()+ " pages.");
}
==========================================

If you encounter any problem, please feel free to let us know.

>>2) Please provide instruction on using it within our ASPX environment

http://www.verypdf.com/app/pdf-split-merge/try-and-buy.html#buy-sdk

Thanks for your message, please run a cmd window by administrator privilege, and then run following command line to register the COM Component,

VeryPDFSplitMergeCOM.exe /regserver

after that, you can call "com_VerySplitMergePDFEx" to split and merge PDF files,

private void button2_Click(object sender, EventArgs e)
{
string appPath = Path.GetDirectoryName(Application.ExecutablePath);
System.Type VeryPDFSplitMergeCOMType = System.Type.GetTypeFromProgID("VeryPDFSplitMergeCOM.com");
VeryPDFSplitMergeCOM.com VeryPDFSplitMergeCOM = (VeryPDFSplitMergeCOM.com)System.Activator.CreateInstance(VeryPDFSplitMergeCOMType);

VeryPDFSplitMergeCOM.com_PDF_SetCode("XXXXXXXXXXXXXXXXXXXXXXXXXXX");

string szPDFFile = appPath + "\\testcmd.pdf";
VeryPDFSplitMergeCOM.com_VerySplitMergePDFEx(szPDFFile, "2-5", appPath + "\\_page2-5.pdf");
int nPageCount = VeryPDFSplitMergeCOM.com_VeryGetPDFFilePageCount(appPath + "\\_page2-5.pdf");
MessageBox.Show(appPath + "\\_page2-5.pdf" + " is contain " + nPageCount.ToString()+ " pages.");
}

If you encounter any problem with our products, please feel free to let us know, we will assist you asap.

VeryPDF
-------------------------------------------------------
Will you kindly supply a VB example?

Customer
-------------------------------------------------------
Thanks for your message, please refer to a VB example to call "pdfpage.dll" directly at below, you can use VerySplitMergePDFEx() function to split and merge PDF files easily,

VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 450
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3090
ScaleWidth = 4680
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton Command1
Caption = "PDF Split and Merge"
Height = 1335
Left = 360
TabIndex = 0
Top = 720
Width = 3855
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function VeryAppendPDF Lib "pdfpage.dll" (ByVal ptrExistingPDFName As String, ByVal ptrAppendPDF As String) As Long
Private Declare Function VerySplitMergePDFEx Lib "pdfpage.dll" (ByVal lpInputPDF As String, ByVal lpPageRange As String, ByVal lpOutPDF As String) As Long
Private Declare Function VeryGetPDFFilePageCount Lib "pdfpage.dll" (ByVal lpInputPDF As String) As Long
Private Declare Function VerySplitMergeSetParameter Lib "pdfpage.dll" (ByVal key As String, ByVal value As String) As Long
Private Declare Sub PDF_SetCode Lib "pdfpage.dll" (ByVal strRegcode As String)

Private Sub Command1_Click()
Dim szInputPDFFile As String
Dim szOutputPDFFile As String
Dim szPageRange As String
Dim iRet As Long
Dim iPageCount As Long

PDF_SetCode ("Set your License Key at here")

szInputPDFFile = App.Path + "\" + "testcmd.pdf"
szOutputPDFFile = App.Path + "\" + "testcmd-out.pdf"

'iRet = VerySplitMergeSetParameter("RetainBookmarks","on")
'iRet = VerySplitMergeSetParameter("RetainAcroForms","off")
iRet = VerySplitMergeSetParameter("RetainBookmarks", "off")
iRet = VerySplitMergeSetParameter("RetainAcroForms", "on")

iPageCount = VeryGetPDFFilePageCount(szInputPDFFile)
MsgBox "VeryGetPDFFilePageCount() return: " & iPageCount

'Split and merge pdf files
iRet = VerySplitMergePDFEx(szInputPDFFile, "1,3", szOutputPDFFile)

'iRet = VeryAppendPDF(szOutputPDFFile, szInputPDFFile)

'szOutputPDFFile = App.Path + "\"
'iRet = VerySplitMergePDFEx(szInputPDFFile, "burst", szOutputPDFFile)
End Sub

VeryPDF
-------------------------------------------------------
Questions:
1) We are converting HTML to PDF. The software we replacing took care of paginating if extra pages were needed. Does your software do this?
2) The software we are replacing also allowed us to add headers (images, etc.) and footers (html, and page numbers)

Please provide instructions in VB.

Customer
-------------------------------------------------------

Relevant Software: VeryDOC DOC to Any Converter Command Line and DOC to Any Converter SDK,

http://www.verydoc.com/doc-to-any.html

>>1) We are converting HTML to PDF. The software we replacing took care of paginating if extra pages were needed. Does your software do this?

Thanks for your message, what is your meaning for the "took care of paginating if extra pages were needed"? do you need to add additional blank pages if necessary?

>>2) The software we are replacing also allowed us to add headers (images, etc.) and footers (html, and page numbers)

You can use following C# code to convert HTML file to PDF file using doc2any SDK,
----------------------------
string appPath = Path.GetDirectoryName(Application.ExecutablePath);
string strInFile = "D:\\downloads\\verypdf.html";
string strOutFile = "D:\\downloads\\_test_out.pdf";

string strCmd = "-webkit -$ XXXX-XXXX-XXXX-XXXX";
strCmd += " \"" + strInFile + "\" \"" + strOutFile + "\"";
MessageBox.Show(strCmd);

System.Type VeryPDFType = System.Type.GetTypeFromProgID("VeryPDF.doc2anyCom");
VeryPDF.doc2anyCom VeryPDFCom = (VeryPDF.doc2anyCom)System.Activator.CreateInstance(VeryPDFType);
string strReturn = VeryPDFCom.doc2any(strCmd);
MessageBox.Show("Processing finished.");
----------------------------

You can use "-webkit" option to convert HTML file to PDF file.

You can use following options to add page headers and footers to generated PDF files,

-wtext <string> : Watermark text on printed document
-wtext does support following dynamic values:
%PageCount%, %PageNumber%, %PageCountRoman%, %PageCountRoman2%,
%PageNumberRoman%, %PageNumberRoman2%, %Author%, %Keywords%,
%Subject%, %Title%, %Filename%, %Date%, %Time%
-wtype <int> : type of watermark
0 : normal watermark
1 : watermark on header
2 : watermark on footer
-wf <string> : font name of watermark
-wh <int> : font size of watermark
-wb : specify bold font
-wi : specify an italic font
-wu : specify an underlined font
-ws : specify a strikeout font
-wa <int> : angle of watermark
-wbox <string> : a rectangle to output formatted text, it is only useful for "-walign" option, eg:
-wbox "0,0,595,842"
-wbox "0,0,612,792"
-wbox "auto"
-walign <int> : set text align
1 : left
2 : center
3 : right
-wc <string> : color of watermark,
FF0000: Red color
00FF00: Green color
0000FF: Blue color
HexNum: Other colors
-wx <int> : X offset of watermark
-wy <int> : Y offset of watermark
-wpagebegin <int> : first page to add the watermark
-wpageend <int> : last page to add the watermark
-wpageoffset <int> : a value to be added to page number
-watermarkfile <string> : a .ini file which contain information for multiple watermarks

Add watermarks into PDF files:
doc2any.exe -wtext "VeryPDF" "C:\in.doc" C:\out.pdf
doc2any.exe -wtext "VeryPDF" -wc "0000FF" "C:\in.doc" C:\out.pdf
doc2any.exe -wtext "VeryPDF" -wx 100 -wy 100 "C:\in.doc" C:\out.pdf
doc2any.exe -wtext "VeryPDF" -wtype 1 "C:\in.doc" C:\out.pdf
doc2any.exe -wtext "VeryPDF" -wtype 2 "C:\in.doc" C:\out.pdf
doc2any.exe -wtext "VeryPDF" -wtype 0 -wa 45 "C:\in.doc" C:\out.pdf
doc2any.exe -wtext "VeryPDF" -wf "Arial" "C:\in.doc" C:\out.pdf
doc2any.exe -wtext "VeryPDF" -wf "Arial" -wh 20 "C:\in.doc" C:\out.pdf
doc2any.exe -wtext "VeryPDF" -wf "Arial" -wh 20 -wb -wi -wu -ws "C:\in.doc" C:\out.pdf
doc2any.exe -wtext "VeryPDF" -wf "Arial" -walign 3 -wh 20 -wbox "0,770,612,792" "C:\in.doc" C:\out.pdf
doc2any.exe -wtext "Watermark %PageNumber% of %PageCount%" "C:\in.doc" C:\out.pdf
doc2any.exe -wtext "Watermark %PageNumber% of %PageCount%" -wpagebegin 10 -wpageend 20 -wpageoffset 100 "C:\in.doc" C:\out.pdf
doc2any.exe -wtext "Watermark %PageNumberRoman% of %PageCountRoman%" "C:\in.doc" C:\out.pdf
doc2any.exe -wtext "Watermark %PageNumberRoman2% of %PageCountRoman2%" "C:\in.doc" C:\out.pdf
doc2any.exe -wtext "Watermark %PageNumber% of %PageCount%" -walign 3 -wtype 1 "C:\in.doc" C:\out.pdf
doc2any.exe -wtext "Watermark %PageNumber% of %PageCount%" -walign 2 -wtype 2 "C:\in.doc" C:\out.pdf
doc2any.exe -wtext "%Filename% %Date% %Time% %PageNumber% of %PageCount%" "C:\in.doc" C:\out.pdf

for example,

doc2any.exe -webkit -wtype 1 -wtext "Watermark %PageNumber% of %PageCount%" http://www.verypdf.com D:\downloads\_out.pdf

Please feel free to let us know if you have any question for above functions.

VeryPDF

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

This entry was posted in DOC to Any Converter, HTML Converter (htmltools), PDF Split-Merge and tagged , , , , . Bookmark the permalink.

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!