Click here to Skip to main content
15,900,725 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,I devloped one application to save current html webpage to pdf file in MFC.It is saved as in .pdf format.but that pdf file is not opening.its showing cannot open file because it was not data decoded correctly.how to decode data.pls help me
Posted
Updated 28-Apr-11 4:14am
v2
Comments
OriginalGriff 28-Apr-11 10:26am    
Without knowing how you saved the file - i.e. see the relevant code fragment - we would be reduced to our famous psychic powers...
Manfred Rudolf Bihy 28-Apr-11 10:30am    
Come on Griff, give us another sample of your powerfull mindreading capabilities.

:)
OriginalGriff 28-Apr-11 10:38am    
OK, :ScienceFictionSoundEffect: My mindscan of his HDD says that he saved the raw HTML in a file with a .pdf extension in the firm belief that the extension is the only thing that matters, the content format is irrelevant.

Mind you, that's not psychic powers, that's cynicism!
Joan M 28-Apr-11 11:44am    
Wooooooooooooooooooow! Completely scared now... I think I will have to put a McDonnalds paper bag on my head in order to prevent you for reading my mind... :O
OriginalGriff 28-Apr-11 14:21pm    
If you want to, but it'll just make your hair smell of fries.
Tin foil, that's the hat you want. Tin foil. Manfred can sell you some :laugh:

One of the simplest ways to generate PDF from code is to use a PDF printer driver. I don't know what you are using now, but unless you want advanced customization, I'd recommend this approach.
 
Share this answer
 
As Nish Suggest, check any printer like PDFCreator[^].

Here you can use two approaches:

1. use it as a printer and simplify your job.
2. As it is a opensource project take a look at the code it uses.

Apart from that you can check the articles that are here in CP:

Pdfizer, a dumb HTML to PDF converter, in C#[^]
Generate PDF documents from a HTML page using ASP.NET[^]

HTH!
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900