How to convert image to PDF from C#?

Question:I have a "trial" version of img2pdf.exe that I have tested successfully. I am writing an application in Visual Studio .NET with C# that will be deployed as a web-application on one of our servers. I have a requirement to convert .tiff files to .pdf files within the program.I know that img2pdf.exe works fine in a "command line" mode. Do you have an implementation that I can use within my VS Project? What licenses do I need for development as well as on the server?

Answer:According to your needs, you can use VeryPDF Image to PDF COM which can be used to convert raster images such as TIFF, JPM and JPEG to PDF and PDF/A or PDF documents for electronic archiving or electronic data exchange together with API: C#, Java, .NET, ect. And by the Server License, you can apply this software to the whole server. Meanwhile under one Server License, you can use the corresponding SOFTWARE on exactly one server computer that offers service to clients. If the SOFTWARE contains source codes, you have the right to modify and reuse the codes under the Server License.  In the following part, let us check how to convert tiff to PDF from  C#.

Step 1. Download Image to PDF SDK/COM

  • There are many elements including in this software, for uploading and downloading easy, we have compressed it to zip file. Once download finishes, please extract it to some folder then you can check the elements in it.
  • There are five sub folders included in this folder. And there is one PDF manual about how to use this software. Even if this manual is about PDF Editor Toolkit SDK but PDF to image converting  is included in this software.

Step 2. Converting image to PDF from C#

    • Please do the conversion following examples and be in compliance with the usage.

Sample: Visual C++

void main()
{
char szPDFFile[256];
char szImageFile[256];
long id;
memset(szPDFFile,0,256);
memset(szImageFile,0,256);
if(!LoadVeryWDll())
return ;
GetModulePath(szPDFFile,"append.pdf");
id=pVeryOpen(szPDFFile);
if(id>0)
{
pVeryAddInfo(id,"Title","Subject","Author",
 "Keywords""Creator");
pVerySetFunction(id,Very_Set_ViewerPreferences,4+4096,2,0,0)
//add image file types
AddTIFFImage(id);
AddJPGImage(id)
AddWMFImage(id);
//add bookmark
pVerySetFunction(id,Very_Set_BookMark,0,0,
"bookmark three" ,0)
//add image four, the example for bit 24 bmp
AddImageData(id);
AddText(id);
AddLineAndRect(id);
AddTextFile(id);
AddTextExample2(id);
CharTable(id);
pVeryClose(id);
}
FreeVeryWDll();
ShellExecute(NULL,"open",szPDFFile,NULL,NULL,SW_SHOWNORMAL);
}
And there are more examples included in the downloaded package. If you want to get one, please pay for it then you can use it forever. During the using, if you have any question, please contact us as soon as possible.

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

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!