pdf to jpg
Convert pdf file to jpg file and use L_LoadBitmap and L_SaveBitmap.
Target file is bad and quality is loss.
What do I wrong ?
============[ DPI problem ]==============
I search forum and find that DPI problem..
But can`t......
LoadFileOption.XResolution = 96;
LoadFileOption.YResolution = 96 or 72 or 300 or 400 or 1200 DPI change result same.....
==================================
========= [zip exe file]=================
input and output file attachment
1) double click
2) select target folder
3) bottom-left button
4) you can see....
===================================
///////////////////////////// [ Sample Code ] ///////////////////////////////////////////////////////////
SHORT CL_LeadFilterCtrl::CreateJPG(LPCTSTR Input, LPCTSTR Output)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
Input="c:\\sample.pdf";
Output="c:\\";
//1. Declare the following variables:
BITMAPHANDLE LeadBitmap = {0}; // LEAD bitmap
FILEINFO FileInfo = {0}; // File info
L_INT PageNumber, TotalPages; // Page numbers
LOADFILEOPTION LoadFileOption = {0}; // Loading options
char szOutFileName[MAX_PATH]; // output file name
//2. Find out the number of pages in the file
L_FileInfo((L_TCHAR*)Input, &FileInfo, sizeof(FILEINFO), FILEINFO_TOTALPAGES, NULL);
TotalPages = FileInfo.TotalPages;
//3. Loop through the pages of the file
L_GetDefaultLoadFileOption(&LoadFileOption, sizeof(LOADFILEOPTION));
LoadFileOption.XResolution = 96;
LoadFileOption.YResolution = 96; ///// DPI change
for (PageNumber=1; PageNumber<=TotalPages; ++PageNumber)
{
//4. Inside the loop, do the following:
//4.1 Load the next image in the loop
LoadFileOption.PageNumber = PageNumber;
L_LoadBitmap((L_TCHAR*)Input, &LeadBitmap, sizeof(BITMAPHANDLE), 24, ORDER_BGRORGRAY, &LoadFileOption, NULL);
//4.2 Check that it's properly loaded and allocated
if(LeadBitmap.Flags.Allocated)
{
//4.3 Save page to a separate file
wsprintf(szOutFileName, "%sPageNumber%4.4d.jpg",Output, PageNumber);
L_SaveBitmap(szOutFileName, &LeadBitmap, FILE_JPEG_411, 24, 2, NULL);
//4.4 Free image from memory
L_FreeBitmap(&LeadBitmap);
}
}
return SUCCESS;
}
oh plz >.<