/    Sign up×
Community /Pin to ProfileBookmark

convert pdf to jpeg problem ??

Hello forums !!
I have one question regarding pdf to jpeg conversion.
Is it possible to convert pdf file(with ‘x’ no of pages) to jpeg files(corresponding to ‘x’ no of pdf pages) ?
ie every pdf page should result a single jpeg image.
How this can be accomplished using php4/php5 ?
Any suggestion n tips would be very greatful.
Thank you.

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@Abigail111Aug 07.2013 — Of course it's possible to convert pdf to jpeg.you can follow the code to do it:namespace RE__Test

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

public static string FolderName = "c:/";

private void button1_Click(object sender, EventArgs e)
{
string fileName = FolderName + "Sample.pdf";

REDocument doc = REFile.OpenDocumentFile(fileName, new PDFDecoder());//use PDFDecoder open a pdf file

int pageCount = doc.GetPageCount();//get pdf's page count

for (int pgIdx = 0; pgIdx < pageCount; pgIdx++)
{
BasePage aPage = doc.GetPage(pgIdx);//get page from REDocument

try
{
REImage img = (REImage)aPage.ToImage();//translate page to image
REFile.SaveImageFile(img, FolderName + "output" + pgIdx + ".jpg", new JPGEncoder());//save image
}
catch (Exception)
{
Debug.WriteLine("Fail to display page " + pgIdx);
}
}

}

}
×

Success!

Help @PHPycho spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.11,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...