Create PDF

Participant ,
Sep 25, 2019 Sep 25, 2019

Copy link to clipboard

Copied

Bonjour,

Je voudrais créer un PDF suite à une mémorisation dans une variable :

<CFOUTPUT>	
	<!--- Debut de la memorisation des informations dans C --->
	<cfset C= "">
	<cfset C=C & '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'& #CRLF#> 
	<cfset C=C & '<html>'& #CRLF#>  
	<cfset C=C & '<head>'& #CRLF#>  
	<cfset C=C & '<title>Les aventures de l'extrème</title>'& #CRLF#>  
	<cfset C=C & '</head>'& #CRLF#>  
	<cfset C=C & '<body>'& #CRLF#> 
	<cfset C=C & '<p style="text-align: center;"><br /></p>' & #CRLF#>
	<cfset C=C & '<p style="text-align: center;"><br /></p>'& #CRLF#>
	<cfset C=C & '<p style="text-align: center;"><br /></p>' & #CRLF#>
	<cfset C=C & '<cfdocumentitem type="pagebreak"/>'>
    <cfset C=C & '<p><br /></p>'& #CRLF#>
    <cfset C=C & '<p style="text-align: center;">Albert Dupontel</p>'& #CRLF#>
  	<cfset C=C & '<p><br /></p>'& #CRLF#>
  	<cfset C=C & '<p><br /></p>'& #CRLF#>
  	<cfset C=C & '<h1 style="text-align: center;"><h1>Les aventures de l'extrème</h1>'& #CRLF#>
  	<cfset C=C & '<p><br /></p>'& #CRLF#>
  	<cfset C=C & '<p><br /></p>'& #CRLF#>
  	<cfset C=C & '<p><br /></p>'& #CRLF#>
  	<cfset C=C & '<p><br /></p>'& #CRLF#>
	<cfset C=C & '<cfdocumentitem type="pagebreak"/>'>
	<cfset C=C & '<p><br /></p>' & #CRLF#>
	<cfset C=C & '<p><br /></p>' & #CRLF#>
	<cfset C=C & '<p style="text-align: center;"><br /></p>'& #CRLF#>
	<cfset C=C & '<p style="text-align: center;"><br /></p>' & #CRLF#>
  	<cfset C=C & '<p style="text-align: center;">Le code de propri&eacute;t&eacute; intellectuelle interdit les copies ou reproductions destin&eacute;es&nbsp;&agrave;&nbsp; une utilisation collective.</p>' & #CRLF#>
  	<cfset C=C & '<p style="text-align: center;">Toute reproduction ou repr&eacute;sentation int&eacute;grale ou partielle faite par quelque proc&eacute;d&eacute;</p>' & #CRLF#> 
	<cfset C=C & '<p style="text-align: center;">que ce soit sans le consentement des auteurs ou de ses ayants droit ou ayants cause est illicite et constitue</p>' & #CRLF#> 
	<cfset C=C & '<p style="text-align: center;">une contre fa&ccedil;on, au terme des paragraphes 2 et 3 des articles 22_5,</p>' & #CRLF#>
	<cfset C=C & '<p style="text-align: center;"> L 122_4, L 335_2 et suivant du Code de la propri&eacute;t&eacute; intellectuelle.</p>' & #CRLF#>
  	<cfset C=C & '<p style="text-align: center;"><br /></p>' & #CRLF#>
  	<cfset C=C & '<p style="text-align: center;">&copy; Albert Dupontel</p>' & #CRLF#>
 	<cfset C=C & '<p style="text-align: center;">D&eacute;pot l&eacute;gal : #DateFormat(Now(),"YYYY-MM-DD")#</p>' & #CRLF#>
	<cfset C=C & '<cfdocumentitem type="pagebreak"/>'>
	<cfset C=C & '<p class="reference" style="text-align: center;"><br /></p>' & #CRLF#>
  	<cfset C=C & '<p class="reference" style="text-align: center;"><br /></p>' & #CRLF#>
	<cfset C=C & '<p class="reference" style="text-align: center;"><br /></p>' & #CRLF#>
	<cfset C=C & '<p class="reference" style="text-align: center;"><br /></p>' & #CRLF#>
  	<cfset C=C & '<p class="reference" style="text-align: center;"><br /></p>' & #CRLF#>
  	<cfset C=C & '<p class="reference" style="text-align: center;">Adaptation e-book : #DateFormat(Now(),"YYYY-MM-DD")#</p>' & #CRLF#>
	<cfset C=C & '<p class="reference" style="text-align: center;"><br /></p>' & #CRLF#>
  	<cfset C=C & '<p class="reference" style="text-align: center;"><br /></p>' & #CRLF#>
  	<cfset C=C & '<p class="reference" style="text-align: center;"><u><a href="http://Abertdupontel@hotmail.com/">Abert Dupontel</a></u></p>' & #CRLF#>
	<cfset C=C & '<p class="reference" style="text-align: center;"><br /></p>' & #CRLF#>
  	<cfset C=C & '<p class="reference" style="text-align: center;"><br /></p>' & #CRLF#>
	<cfset C=C & '<cfdocumentitem type="pagebreak"/>'>
	<cfset C=C & '<h2>Avertissement</h2>'& #CRLF#>
	<cfset C=C & 'Ce livre raconte une enquête policière étrange. C’est aussi une histoire romancée de mes ascendants. Julie de Bozonnier de Vaumane a réellement vécu. Elle est mon arrière-grand-mère paternelle.
Tous les événements historiques relatés dans les pages que vous allez lire sont réels. Les personnages ont existé, ainsi que les lieux. Bien sûr les dialogues sont inventés, les situations imaginées, les sentiments romancés.
'& #CRLF#>
	<cfset C=C & '</body>'& #CRLF#>
	<cfset C=C & '</html>'& #CRLF#>
	
	
	
	<!---  Construction et affichage du PDF --->
	<CFDOCUMENT format="PDF" 
				filename="MyPDF.pdf" 
				overwrite="Yes">
				#C#
	</CFDOCUMENT> 
	
	<cfheader name="Content-Disposition" 
		      value="attachment;filename=MyPDF.pdf"> 
	<cfcontent type="application/PDF"
			   file="#DIR#/MyPDF.pdf" 
			   deletefile="Yes"> 

	<!---  Ecriture du PDF --->
	<CFFILE action="WRITE" 
			file="#DIR#/MyPDF.pdf"  
			output="#C#">   
			
</CFOUTPUT>

 A chaque fois j'ai le même message : Nous n'avons pas pu ouvrir le PDF. Un problème empéche l'ouverture du PDF.

Je pensais que cela pouvait venir des accentués mais mais malgré un parser, j'ai le même résultat.

Merci pour votre aide.

TOPICS
Advanced techniques

Views

672

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct Answer

Participant , Nov 19, 2019 Nov 19, 2019
Bonjour,Je voulais vous remercier tous (et surtout BKBK) pour votre aide et pour votre ... patience.J'ai appris beaucoup de choses.Encore merciCordialement Hello,I wanted to thank you all (and especially BKBK) for your help and for your ... patience.I learned a lot of things.Thanks againCordially

Likes

Translate

Translate
LEGEND ,
Oct 28, 2019 Oct 28, 2019

Copy link to clipboard

Copied

CFDOCUMENTITEM pagebreak will not work because it is part of the string, and CF does not process it.  It just adds that code to the HTML that the PDF is generated from.

 

Glad you got it working, though.

 

V/r,

 

^ _ ^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Oct 28, 2019 Oct 28, 2019

Copy link to clipboard

Copied

<cfset CRLF = chr (13) & chr (10) />
	<!--- Debut de la memorisation des informations dans C --->

		<cfset C="">
		<cfset C2="">
		<cfset C3="">
		<cfset C4="">
		<cfset C5="">
		<cfset C6="">
		
		<cfset C=C& "<p><html></p>" & CRLF>
		<cfset C=C& "<p><body></p>" & CRLF>
		<cfset C=C& "<p><br /></p>" & CRLF>
		<cfset C=C& "<p><br /></p>" & CRLF>
		<cfset C=C& '<p align=center><IMG src="#DIRI#\Couv.jpg" border="0" align="top"></p>'& #CRLF#>
		<cfset C=C& "<p><br /></p>" & CRLF>
		<cfset C=C& "<p><br /></p>" & CRLF>
		<cfset C=C& "<p><br /></p>" & CRLF>
					
		<cfset C2=C2& "<p><br /></p>" & CRLF>
		<cfset C2=C2& "<p><br /></p>" & CRLF>
		<cfset C2=C2& "<p><br /></p>" & CRLF>
	
		<cfset C3=C3& "<p><br /></p>" & CRLF>
		<cfset C3=C3& "<h2 align=center>#Auteur#</h2>"& CRLF>
		<cfset C3=C3& "<p><br /></p>" & CRLF>
		<cfset C3=C3& "<p><br /></p>" & CRLF>
		<cfset C3=3C& "<h1 align=center>#Titre#</h1>"& CRLF>
		<cfset C3=C3& "<p><br /></p>" & CRLF>
	
		<cfset C4=C4& "<p><br /></p>" & CRLF>
		<cfset C4=C4& "<p><br /></p>" & CRLF>
		<cfset C4=C4& "<p><br /></p>" & CRLF>
		<cfset C4=C4& "<p><br /></p>" & CRLF>
		<cfset C4=C4& '<p align=center><IMG src="SoLivres.jpg" border="0" align="top"></p>'& #CRLF#>
		<cfset C4=C4& "<p><br /></p>" & CRLF>
		<cfset C4=C4& "<p style='text-align: center;'><a href='http://info@solivres.com/'>www. solivres.com</a>"& #CRLF#>
		<cfset C4=C4& "<p style='text-align: center;'>Adaptation e-book #DateFormat(Now(),'DD-MM-YYYY')#"& #CRLF#>

		<cfset C5=C5& "<p><br /></p>" & CRLF>
		<cfset C5=C5& "<p><br /></p>" & CRLF>
		<cfset C5=C5& "<p><br /></p>" & CRLF>
		<cfset C5=C5& "<p><br /></p>" & CRLF>
		<cfset C5=C5& "<p><br /></p>" & CRLF>
		<cfset C5=C5& "<p><br /></p>" & CRLF>
		<cfset C5=C5& "<p><br /></p>" & CRLF>
		<cfset C5=C5& "<p><br /></p>" & CRLF>
		<cfset C5=C5& "<p><br /></p>" & CRLF>
		<cfset C5=C5& "<p><br /></p>" & CRLF>
		<cfset C5=C5& "<p><br /></p>" & CRLF>
		<cfset C5=C5& "<p><br /></p>" & CRLF>
		<cfset C5=C5& "<p><br /></p>" & CRLF>
		<cfset C5=C5& "<p><br /></p>" & CRLF>
		<cfset C5=C5& "<p><br /></p>" & CRLF>
		<cfset C5=C5& "<p><br /></p>" & CRLF>
		<cfset C5=C5& "<p style='text-align: center;'>Le code de propri&eacute;t&eacute; intellectuelle interdit les copies ou reproductions destin&eacute;es&nbsp;&agrave;&nbsp; une utilisation collective.</p>" & CRLF>
		<cfset C5=C5& "<p style='text-align: center;'>Toute reproduction ou repr&eacute;sentation int&eacute;grale ou partielle faite par quelque proC5&eacute;d&eacute;</p>" & CRLF> 
		<cfset C5=C5& "<p style='text-align: center;'>que ce soit sans le consentement des auteurs ou de ses ayants droit ou ayants cause est illicite et constitue</p>" & CRLF> 
		<cfset C5=C5& "<p style='text-align: center;'>une contre fa&ccedil;on, au terme des paragraphes 2 et 3 des articles 22_5,</p>" & CRLF>
		<cfset C5=C5& "<p style='text-align: center;'> L 122_4, L 335_2 et suivant du Code de la propri&eacute;t&eacute; intellectuelle.</p>" & CRLF>
		<cfset C5=C5& "<p style='text-align: center;'><br /></p>" & CRLF>
		<cfset C5=C5& "<p style='text-align: center;'>&copy; #Auteur#</p>" & CRLF>
		<cfset C5=C5& "<p style='text-align: center;'>D&eacute;pot l&eacute;gal : #DateFormat(Now(),'DD-MM-YYYY')#</p>" & CRLF>
		<cfset C5=C5& "<p style='text-align: center;'><u>Email : <a href='http://JeanMarcIRLES@hotmail.com/'>#Auteur#</a></u></p>" & CRLF>
		<cfset C5=C5& "<p><br /></p>" & CRLF>
		<cfset C5=C5& "<p><br /></p>" & CRLF>

		<cfset C6=C6& "<p><br /></p>" & CRLF>
		<cfset C6=C6& "<p><br /></p>" & CRLF>
		<cfset C6=C6& "<p><br /></p>" & CRLF>
		<cfset C6=C6& "<p><br /></p>" & CRLF>
		<cfset C6=C6& "<p><br /></p>" & CRLF>
		<cfset C6=C6& "<p><br /></p>" & CRLF>
		<cfset C6=C6& "<p><br /></p>" & CRLF>
		<cfset C6=C6& "<p><br /></p>" & CRLF>
		<cfset C6=C6& "<p><br /></p>" & CRLF>
		<cfset C6=C6& "<p><br /></p>" & CRLF>
		<cfset C6=C6& "<p><br /></p>" & CRLF>
		<cfset C6=C6& "<p><br /></p>" & CRLF>
		<cfset C6=C6& "<p><br /></p>" & CRLF>
		<cfset C6=C6& "<p><br /></p>" & CRLF>
		<cfset C6=C6& "<p><br /></p>" & CRLF>
		<cfset C6=C6& "<p><br /></p>" & CRLF>
		<cfset C6=C6& "<h2>#ChapitresTitle#</h2>"& CRLF>
		<cfset C6=C6& "<p>#ChapitresTexte#</p>"& CRLF> 
		<cfset C6=C6& "<p></body></p>" & CRLF>
		<cfset C6=C6& "<p></html></p>" & CRLF>
<CFOUTPUT> 
	<!--- Construction, affichage et écriture du PDF ---> 
	<CFDOCUMENT
			FORMAT="PDF" 
			filename="#DIR#/MyPDF.pdf" 
			overwrite="Yes">
			#C#
			<cfdocumentitem type='pagebreak'/> 
			#C2#
			<cfdocumentitem type='pagebreak'/> 
			#C3#
			<cfdocumentitem type='pagebreak'/> 
			#C4#
			<cfdocumentitem type='pagebreak'/> 
			#C5#
			<cfdocumentitem type='pagebreak'/> 
			#C6# 
	</CFDOCUMENT> 
	
	<CFMAIL TO="jmbusselet@hotmail.com" 
			FROM="marc75paris@outlook.fr" 
			type="HTML" 
			SUBJECT="voici une copie"> 
			<cfmailparam file = "#DIR#/MyPDF.pdf"/> 
		Veuillez trouvez ci-joint le pdf demandé
	</CFMAIL> 

<cfheader name="Content-Disposition" value="attachment;filename=MyPDF.pdf">

<!--- Affichage PDF --->
<cfcontent type="application/PDF" file="#DIR#/MyPDF.pdf" deletefile="No"> 

</CFOUTPUT> 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Oct 28, 2019 Oct 28, 2019

Copy link to clipboard

Copied

Code inutile:

<CFFILE action="WRITE" file="#DIR#/MyPDF.pdf" output="#C#">  

 Pièce jointe:

<cfmailparam file = "#DIR#/MyPDF.pdf"/>

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 30, 2019 Oct 30, 2019

Copy link to clipboard

Copied

Bonjour,

Tout est parfait sauf que ... je ne peux ouvrir le PDF.

J'ai le message suivant :

"Nous n’avons pas pu ouvrir le PDF

Un problème empêche l’ouverture de ce PDF."

Quand j'examine le PDF en le mettant en .txt, pas de transformation ! juste mon code

Merci pour votre aide si précieuse 

 

Hello,
Everything is perfect except that ... I can not open the PDF.
I have the following message:
"We could not open the PDF
A problem prevents the opening of this PDF".
When I examine the PDF by putting it in .txt, no transformation! just my code
Thank you for your help so precious

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 04, 2019 Nov 04, 2019

Copy link to clipboard

Copied

Bonjour,

Pas de solutions ?

Dommage de créer un PDF et ne pouvoir le lire.

Merci par avance pour votre aide.

 

Hello,
No solutions?
Too bad to create a PDF and not being able to read it.
Thank you in advance for your help.

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Nov 04, 2019 Nov 04, 2019

Copy link to clipboard

Copied

When I use your code, the PDF file can be opened without any problem.

Please show us the exact code that you're currently using.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 09, 2019 Nov 09, 2019

Copy link to clipboard

Copied

Bonjour,

Voici le code que j'utilise :

Hello,

Here is the code I use : 

 

 

<HTML>
<! DOCTYPE html /> 
<HEAD>
	<CFOUTPUT>
	<CFINCLUDE template="../inc_init_admin.cfm">
	<CFINCLUDE template="../inc_verif_var2.cfm"> 
	<cfset Auteur="Jean-Marc IRLES"> 
	<cfset Titre="Le dernier secret de Julie Finet">
	<cfset ChapitresTitle="Avertissement">
	<cfset ChapitresTexte="Ce livre raconte une enquête policière étrange. C’est aussi une histoire romancée de mes ascendants. Julie de Bozonnier de Vaumane a réellement vécu. Elle est mon arrière-grand-mère paternelle.
	Tous les événements historiques relatés dans les pages que vous allez lire sont réels. Les personnages ont existé ainsi que les lieux. Bien sûr, les dialogues sont inventés, les situations imaginées, les sentiments romancés.">
	<cfset DIR=#db_dir# & "SoLivres" & "\" &"_Ebooks" & "\" &"SoLivres" & "\" &"#Auteur#" & "\" & "#Titre#">
	<cfset DIRI="..\..\..\" & "SoLivres"& "\" &"_Ebooks" & "\" &"SoLivres" & "\" &"#Auteur#" & "\" & "#Titre#" & "\" & "images">
<!--- 	DIR : #DIR#<BR>
	DIRI : #DIRI#<BR> --->
	</CFOUTPUT>
</HEAD>

 <BODY>
	<CFOUTPUT>
	<!--- parser pour accentués et autres --->
	<CFIF trim(Auteur) IS NOT "">
		<cfset chr=#Auteur#>
		<CFINCLUDE template="../inc_parser.cfm">
		<cfset Auteur=#chr#>
	</CFIF>

	<CFIF trim(Titre) IS NOT "">
		<cfset chr=#Titre#>
		<CFINCLUDE template="../inc_parser.cfm">
		<cfset Titre=#chr#>
	</CFIF> 
	
	
	
	<cfset CRLF = chr (13) & chr (10) />
	<!--- Debut de la memorisation des informations dans C --->
		<cfset C="">
		<cfset C1="">
		<cfset C2="">
		<cfset C3="">
		<cfset C4="">

		<cfset C=C& "<p><html></p>" & CRLF>
		<cfset C=C& "<p><body></p>" & CRLF>
		<cfset C=C& "<p><br /></p>" & CRLF>
		<cfset C=C& "<p><br /></p>" & CRLF>
		<cfset C=C& '<p align=center><IMG src="#DIRI#\Couv.jpg" border="0" align="top"></p>'& #CRLF#>
		
		<cfset C1=C1& "<p><br /></p>" & CRLF>
		<cfset C1=C1& "<p><br /></p>" & CRLF>
		<cfset C1=C1& "<p><br /></p>" & CRLF>
		<cfset C1=C1& "<p><br /></p>" & CRLF>
		<cfset C1=C1& "<h2 align=center>#Auteur#</h2>"& CRLF>
		<cfset C1=C1& "<p><br /></p>" & CRLF>
		<cfset C1=C1& "<p><br /></p>" & CRLF>
		<cfset C1=C1& "<h1 align=center>#Titre#</h1>"& CRLF>
		<cfset C1=C1& "<p><br /></p>" & CRLF>
		<cfset C1=C1& "<p><br /></p>" & CRLF>
        <cfset C1=C1& '<p align=center><IMG src="SoLivres.jpg" border="0" align="top"></p>'& #CRLF#>
		
		<cfset C2=C2& "<p><br /></p>" & CRLF>
		<cfset C2=C2& "<p><br /></p>" & CRLF>
		<cfset C2=C2& "<p><br /></p>" & CRLF>
		<cfset C2=C2& "<p><br /></p>" & CRLF>
		<cfset C2=C2& "<p><br /></p>" & CRLF>
		<cfset C2=C2& '<p align=center><IMG src="SoLivres.jpg" border="0" align="top"></p>'& #CRLF#>
		<cfset C2=C2& "<p><br /></p>" & CRLF>
		<cfset C2=C2& "<p style='text-align: center;'><a href='http://info@solivres.com/'>www. solivres.com</a>"& #CRLF#>
		<cfset C2=C2& "<p style='text-align: center;'>Adaptation e-book #DateFormat(Now(),'DD-MM-YYYY')#"& #CRLF#>

		
		<cfset C3=C3& "<p><br /></p>" & CRLF>
		<cfset C3=C3& "<p><br /></p>" & CRLF>
		<cfset C3=C3& "<p><br /></p>" & CRLF>
		<cfset C3=C3& "<p><br /></p>" & CRLF>
		<cfset C3=C3& "<p><br /></p>" & CRLF>
		<cfset C3=C3& "<p><br /></p>" & CRLF>
		<cfset C3=C3& "<p><br /></p>" & CRLF>
		<cfset C3=C3& "<p><br /></p>" & CRLF>
		<cfset C3=C3& "<p><br /></p>" & CRLF>
		<cfset C3=C3& "<p><br /></p>" & CRLF>
		<cfset C3=C3& "<p><br /></p>" & CRLF>
		<cfset C3=C3& "<p style='text-align: center;'>Le code de propri&eacute;t&eacute; intellectuelle interdit les copies ou reproductions destin&eacute;es&nbsp;&agrave;&nbsp; une utilisation collective.</p>" & CRLF>
		<cfset C3=C3& "<p style='text-align: center;'>Toute reproduction ou repr&eacute;sentation int&eacute;grale ou partielle faite par quelque proc&eacute;d&eacute;</p>" & CRLF> 
		<cfset C3=C3& "<p style='text-align: center;'>que ce soit sans le consentement des auteurs ou de ses ayants droit ou ayants cause est illicite et constitue</p>" & CRLF> 
		<cfset C3=C3& "<p style='text-align: center;'>une contre fa&ccedil;on, au terme des paragraphes 2 et 3 des articles 22_5,</p>" & CRLF>
		<cfset C3=C3& "<p style='text-align: center;'> L 122_4, L 335_2 et suivant du Code de la propri&eacute;t&eacute; intellectuelle.</p>" & CRLF>
		<cfset C3=C3& "<p style='text-align: center;'><br /></p>" & CRLF>
		<cfset C3=C3& "<p style='text-align: center;'>&copy; #Auteur#</p>" & CRLF>
		<cfset C3=C3& "<p style='text-align: center;'>D&eacute;pot l&eacute;gal : #DateFormat(Now(),'DD-MM-YYYY')#</p>" & CRLF>
		<cfset C3=C3& "<p style='text-align: center;'><u>Email : <a href='http://JeanMarcIRLES@hotmail.com/'>#Auteur#</a></u></p>" & CRLF>
		
		<cfset C4=C4& "<p><br /></p>" & CRLF>
		<cfset C4=C4& "<p><br /></p>" & CRLF>
		<cfset C4=C4& "<p><br /></p>" & CRLF>
		<cfset C4=C4& "<p><br /></p>" & CRLF>
		<cfset C4=C4& "<p><br /></p>" & CRLF>
		<cfset C4=C4& "<p><br /></p>" & CRLF>
		<cfset C4=C4& "<p><br /></p>" & CRLF>
		<cfset C4=C4& "<p><br /></p>" & CRLF>
		<cfset C4=C4& "<p><br /></p>" & CRLF>
		<cfset C4=C4& "<h2>#ChapitresTitle#</h2>"& CRLF>
		<cfset C4=C4& "<p>#ChapitresTexte#</p>"& CRLF> 
		<cfset C4=C4& "<p></body></p>" & CRLF>
		<cfset C4=C4& "<p></html></p>" & CRLF>



	<!--- Construction et affichage du PDF ---> 
	<CFDOCUMENT
			FORMAT="PDF" 
			filename="#DIR#/MyPDF.pdf" 
			overwrite="Yes">
			#C#
			<cfdocumentitem type='pagebreak'/> 
			#C2#
			<cfdocumentitem type='pagebreak'/> 
			#C3#
			<cfdocumentitem type='pagebreak'/> 
			#C4#
	</CFDOCUMENT> 
	
	<!--- Ecriture du PDF ---> 
	<CFFILE action="WRITE" file="#DIR#/MyPDF.pdf" output="#C#">  
	
	<CFMAIL TO="jmbusselet@hotmail.com" 
			FROM="marc75paris@outlook.fr" 
			type="HTML" 
			SUBJECT="voici une copie"> 
			<cfmailparam file = "#DIR#/MyPDF.pdf"/> 
		Veuillez trouvez ci-joint le pdf demandé
	</CFMAIL> 
	
<!--- Affichage PDF --->
<cfheader name="Content-Disposition" value="attachment;filename=MyPDF.pdf"> 
<cfcontent type="application/PDF" file="#DIR#/MyPDF.pdf" deletefile="No">  

</CFOUTPUT> 
	
<BR>
Fini

 

Merci pour votre aide.

Thanks for your help

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Nov 09, 2019 Nov 09, 2019

Copy link to clipboard

Copied

There are problems in this code:

1) The HTML tags are not part of the PDF content; they should be.

2) <cffile action="write"> is unnecessary. I have said this at least 3 times!

3) You have brought back #CRLF# even though you were advised on several occasions to replace it with CRLF.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Nov 09, 2019 Nov 09, 2019

Copy link to clipboard

Copied

Suggestions:

1) Delete unneccessary # symbols.

2) Delete the cffile-write tag. It is unncessary because cfdocument writes the file.

3) Use cfsavecontent to group the code at the top into a variable called docIntro.

4) Include the contents of C1 in the cfdocument tag.

5) Remove the tags <html>, <body> from the original definition of  the variable C. That is because you have introduced a new set of tags <html> and <body> above.

Initialize C with: 

 

<cfset C=docIntro>

 

 

<cfsavecontent variable="docIntro" >
<HTML>
<! DOCTYPE html /> 
<HEAD>
	<CFINCLUDE template="../inc_init_admin.cfm">
	<CFINCLUDE template="../inc_verif_var2.cfm"> 
	<cfset Auteur="Jean-Marc IRLES"> 
	<cfset Titre="Le dernier secret de Julie Finet">
	<cfset ChapitresTitle="Avertissement">
	<cfset ChapitresTexte="Ce livre raconte une enquête policière étrange. C’est aussi une histoire romancée de mes ascendants. Julie de Bozonnier de Vaumane a réellement vécu. Elle est mon arrière-grand-mère paternelle.
	Tous les événements historiques relatés dans les pages que vous allez lire sont réels. Les personnages ont existé ainsi que les lieux. Bien sûr, les dialogues sont inventés, les situations imaginées, les sentiments romancés.">
	<cfset DIR=db_dir & "SoLivres" & "\" & "_Ebooks" & "\" & "SoLivres" & "\" & Auteur & "\" & Titre >
	<cfset DIRI="..\..\..\" & "SoLivres" & "\" & "_Ebooks" & "\" & "SoLivres" & "\" & Auteur & "\" & Titre & "\" & "images">
<!--- 	DIR : #DIR#<BR>
	DIRI : #DIRI#<BR> --->
</HEAD>

 <BODY>
	<!--- parser pour accentués et autres --->
	<CFIF trim(Auteur) IS NOT "">
		<cfset chr=Auteur>
		<CFINCLUDE template="../inc_parser.cfm">
		<cfset Auteur=chr>
	</CFIF>

	<CFIF trim(Titre) IS NOT "">
		<cfset chr=Titre>
		<CFINCLUDE template="../inc_parser.cfm">
		<cfset Titre=chr>
	</CFIF> 
</cfsavecontent>

	
	
	<cfset CRLF = chr (13) & chr (10) />
	
<CFOUTPUT>
	<!--- Debut de la memorisation des informations dans C --->
		<cfset C=docIntro>
		<cfset C1="">
		<cfset C2="">
		<cfset C3="">
		<cfset C4="">
		<cfset C=C& "<p><br /></p>" & CRLF>
		<cfset C=C& "<p><br /></p>" & CRLF>
		<cfset C=C& '<p align=center><IMG src="#DIRI#\Couv.jpg" border="0" align="top"></p>'& CRLF>
		
		<cfset C1=C1& "<p><br /></p>" & CRLF>
		<cfset C1=C1& "<p><br /></p>" & CRLF>
		<cfset C1=C1& "<p><br /></p>" & CRLF>
		<cfset C1=C1& "<p><br /></p>" & CRLF>
		<cfset C1=C1& "<h2 align=center>#Auteur#</h2>"& CRLF>
		<cfset C1=C1& "<p><br /></p>" & CRLF>
		<cfset C1=C1& "<p><br /></p>" & CRLF>
		<cfset C1=C1& "<h1 align=center>#Titre#</h1>"& CRLF>
		<cfset C1=C1& "<p><br /></p>" & CRLF>
		<cfset C1=C1& "<p><br /></p>" & CRLF>
        <cfset C1=C1& '<p align=center><IMG src="SoLivres.jpg" border="0" align="top"></p>'& CRLF>
		
		<cfset C2=C2& "<p><br /></p>" & CRLF>
		<cfset C2=C2& "<p><br /></p>" & CRLF>
		<cfset C2=C2& "<p><br /></p>" & CRLF>
		<cfset C2=C2& "<p><br /></p>" & CRLF>
		<cfset C2=C2& "<p><br /></p>" & CRLF>
		<cfset C2=C2& '<p align=center><IMG src="SoLivres.jpg" border="0" align="top"></p>'& CRLF>
		<cfset C2=C2& "<p><br /></p>" & CRLF>
		<cfset C2=C2& "<p style='text-align: center;'><a href='http://info@solivres.com/'>www. solivres.com</a>"& CRLF>
		<cfset C2=C2& "<p style='text-align: center;'>Adaptation e-book #DateFormat(Now(),'DD-MM-YYYY')#"& CRLF>

		
		<cfset C3=C3& "<p><br /></p>" & CRLF>
		<cfset C3=C3& "<p><br /></p>" & CRLF>
		<cfset C3=C3& "<p><br /></p>" & CRLF>
		<cfset C3=C3& "<p><br /></p>" & CRLF>
		<cfset C3=C3& "<p><br /></p>" & CRLF>
		<cfset C3=C3& "<p><br /></p>" & CRLF>
		<cfset C3=C3& "<p><br /></p>" & CRLF>
		<cfset C3=C3& "<p><br /></p>" & CRLF>
		<cfset C3=C3& "<p><br /></p>" & CRLF>
		<cfset C3=C3& "<p><br /></p>" & CRLF>
		<cfset C3=C3& "<p><br /></p>" & CRLF>
		<cfset C3=C3& "<p style='text-align: center;'>Le code de propri&eacute;t&eacute; intellectuelle interdit les copies ou reproductions destin&eacute;es&nbsp;&agrave;&nbsp; une utilisation collective.</p>" & CRLF>
		<cfset C3=C3& "<p style='text-align: center;'>Toute reproduction ou repr&eacute;sentation int&eacute;grale ou partielle faite par quelque proc&eacute;d&eacute;</p>" & CRLF> 
		<cfset C3=C3& "<p style='text-align: center;'>que ce soit sans le consentement des auteurs ou de ses ayants droit ou ayants cause est illicite et constitue</p>" & CRLF> 
		<cfset C3=C3& "<p style='text-align: center;'>une contre fa&ccedil;on, au terme des paragraphes 2 et 3 des articles 22_5,</p>" & CRLF>
		<cfset C3=C3& "<p style='text-align: center;'> L 122_4, L 335_2 et suivant du Code de la propri&eacute;t&eacute; intellectuelle.</p>" & CRLF>
		<cfset C3=C3& "<p style='text-align: center;'><br /></p>" & CRLF>
		<cfset C3=C3& "<p style='text-align: center;'>&copy; #Auteur#</p>" & CRLF>
		<cfset C3=C3& "<p style='text-align: center;'>D&eacute;pot l&eacute;gal : #DateFormat(Now(),'DD-MM-YYYY')#</p>" & CRLF>
		<cfset C3=C3& "<p style='text-align: center;'><u>Email : <a href='http://JeanMarcIRLES@hotmail.com/'>#Auteur#</a></u></p>" & CRLF>
		
		<cfset C4=C4& "<p><br /></p>" & CRLF>
		<cfset C4=C4& "<p><br /></p>" & CRLF>
		<cfset C4=C4& "<p><br /></p>" & CRLF>
		<cfset C4=C4& "<p><br /></p>" & CRLF>
		<cfset C4=C4& "<p><br /></p>" & CRLF>
		<cfset C4=C4& "<p><br /></p>" & CRLF>
		<cfset C4=C4& "<p><br /></p>" & CRLF>
		<cfset C4=C4& "<p><br /></p>" & CRLF>
		<cfset C4=C4& "<p><br /></p>" & CRLF>
		<cfset C4=C4& "<h2>#ChapitresTitle#</h2>"& CRLF>
		<cfset C4=C4& "<p>#ChapitresTexte#</p>"& CRLF> 
		<cfset C4=C4& "<p></body>" & CRLF>
		<cfset C4=C4& "<p></html>" & CRLF>



	<!--- Construction et affichage du PDF ---> 
	<CFDOCUMENT
			FORMAT="PDF" 
			filename="#DIR#/MyPDF.pdf" 
			overwrite="Yes">
			#C#
                        #C1#
			<cfdocumentitem type='pagebreak'/> 
			#C2#
			<cfdocumentitem type='pagebreak'/> 
			#C3#
			<cfdocumentitem type='pagebreak'/> 
			#C4#
	</CFDOCUMENT> 
	
	<CFMAIL TO="jmbusselet@hotmail.com" 
			FROM="marc75paris@outlook.fr" 
			type="HTML" 
			SUBJECT="voici une copie"> 
			<cfmailparam file = "#DIR#/MyPDF.pdf"/> 
		Veuillez trouvez ci-joint le pdf demandé
	</CFMAIL> 
	
<!--- Affichage PDF --->
<cfheader name="Content-Disposition" value="attachment;filename=MyPDF.pdf"> 
<cfcontent type="application/PDF" file="#DIR#/MyPDF.pdf" deletefile="No">  

</CFOUTPUT> 

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 19, 2019 Nov 19, 2019

Copy link to clipboard

Copied

LATEST

Bonjour,

Je voulais vous remercier tous (et surtout BKBK) pour votre aide et pour votre ... patience.

J'ai appris beaucoup de choses.

Encore merci

Cordialement

 

Hello,

I wanted to thank you all (and especially BKBK) for your help and for your ... patience.

I learned a lot of things.

Thanks again

Cordially

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 17, 2019 Oct 17, 2019

Copy link to clipboard

Copied

<cfsavecontent variable="C">
<!DOCTYPE html /><!--- This is modern HTML5 doctype; you have HTML4.1 --->
<html>
    <head>
        <title>Les aventures de l'extreme</title>
    </head>
    <body>
<!--- I'm not going to type out all of it, but you put your code here.
BTW, I noticed that you have CFDOCUMENTITEM and I don't think that will work. --->
    </body>
</html>
</cfsavecontent>
<cfmail to="{your email address}" from="{server email address}" subject="here is a copy">
<cfmailparam file="filename.pdf" content="#C#" disposition="attachment" />
Body of email content goes here..
</cfmail>
<cfheader name="content-disposition" value="attachment; filename=filename.pdf" />
<cfcontent type="application/pdf" variable="#C#" />

 

If you follow this example, it should work.  If it doesn't work, check logs and browser console for error messages.

 

HTH,

 

^ _ ^

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Oct 19, 2019 Oct 19, 2019

Copy link to clipboard

Copied

1) Change every occurrence of #CRLF# to CRLF;

2) Replace the line

<cfset C=C & '<title>Les aventures de l'extrème</title>'& CRLF>

with the line

<cfset C=C & "<title>Les aventures de l'extrème</title>" & CRLF>

3) Replace the line

<cfset C=C & '<h1 style="text-align: center;"><h1>Les aventures de l'extrème</h1>'& CRLF>

with the line

<cfset C=C & "<h1 style=""text-align: center;""><h1>Les aventures de l'extrème</h1>" & CRLF>

4) Use the same absolute file path for the attributes <CFDOCUMENT filename="absolute_file_path"> and <cfcontent file="absolute_file_path">. In my example [absolute_file_path =expandpath('MyPDF.pdf')], the PDF file is saved in the current directory.

5) <CFDOCUMENT> creates and writes the PDF to the file path! So, if you set deleteFile="no" (using <cfcontent deletefile="No">), the PDF file will be saved on the file system. It will therefore be unnecessary to use cffile-write

 

<CFOUTPUT>	
	<!--- Debut de la memorisation des informations dans C --->
	<cfset C= "">
	<cfset C=C & '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">' & CRLF> 
	<cfset C=C & '<html>' & CRLF>  
	<cfset C=C & '<head>' & CRLF>  
	
	<cfset C=C & "<title>Les aventures de l'extrème</title>" & CRLF> 
	 
	<cfset C=C & '</head>' & CRLF>  
	<cfset C=C & '<body>' & CRLF> 
	<cfset C=C & '<p style="text-align: center;"><br /></p>' & CRLF>
	<cfset C=C & '<p style="text-align: center;"><br /></p>' & CRLF>
	<cfset C=C & '<p style="text-align: center;"><br /></p>' & CRLF>
	<cfset C=C & '<cfdocumentitem type="pagebreak"/>'>
    <cfset C=C & '<p><br /></p>' & CRLF>
    <cfset C=C & '<p style="text-align: center;">Albert Dupontel</p>' & CRLF>
  	<cfset C=C & '<p><br /></p>' & CRLF>
  	<cfset C=C & '<p><br /></p>' & CRLF>
  	
  	<cfset C=C & "<h1 style=""text-align: center;""><h1>Les aventures de l'extrème</h1>" & CRLF>
  	
  	<cfset C=C & '<p><br /></p>' & CRLF>
  	<cfset C=C & '<p><br /></p>' & CRLF>
  	<cfset C=C & '<p><br /></p>' & CRLF>
  	<cfset C=C & '<p><br /></p>' & CRLF>
	<cfset C=C & '<cfdocumentitem type="pagebreak"/>'>
	<cfset C=C & '<p><br /></p>' & CRLF>
	<cfset C=C & '<p><br /></p>' & CRLF>
	<cfset C=C & '<p style="text-align: center;"><br /></p>' & CRLF>
	<cfset C=C & '<p style="text-align: center;"><br /></p>' & CRLF>
  	<cfset C=C & '<p style="text-align: center;">Le code de propri&eacute;t&eacute; intellectuelle interdit les copies ou reproductions destin&eacute;es&nbsp;&agrave;&nbsp; une utilisation collective.</p>' & CRLF>
  	<cfset C=C & '<p style="text-align: center;">Toute reproduction ou repr&eacute;sentation int&eacute;grale ou partielle faite par quelque proc&eacute;d&eacute;</p>' & CRLF> 
	<cfset C=C & '<p style="text-align: center;">que ce soit sans le consentement des auteurs ou de ses ayants droit ou ayants cause est illicite et constitue</p>' & CRLF> 
	<cfset C=C & '<p style="text-align: center;">une contre fa&ccedil;on, au terme des paragraphes 2 et 3 des articles 22_5,</p>' & CRLF>
	<cfset C=C & '<p style="text-align: center;"> L 122_4, L 335_2 et suivant du Code de la propri&eacute;t&eacute; intellectuelle.</p>' & CRLF>
  	<cfset C=C & '<p style="text-align: center;"><br /></p>' & CRLF>
  	<cfset C=C & '<p style="text-align: center;">&copy; Albert Dupontel</p>' & CRLF>
 	<cfset C=C & '<p style="text-align: center;">D&eacute;pot l&eacute;gal : #DateFormat(Now(),"YYYY-MM-DD")#</p>' & CRLF>
	<cfset C=C & '<cfdocumentitem type="pagebreak"/>'>
	<cfset C=C & '<p class="reference" style="text-align: center;"><br /></p>' & CRLF>
  	<cfset C=C & '<p class="reference" style="text-align: center;"><br /></p>' & CRLF>
	<cfset C=C & '<p class="reference" style="text-align: center;"><br /></p>' & CRLF>
	<cfset C=C & '<p class="reference" style="text-align: center;"><br /></p>' & CRLF>
  	<cfset C=C & '<p class="reference" style="text-align: center;"><br /></p>' & CRLF>
  	<cfset C=C & '<p class="reference" style="text-align: center;">Adaptation e-book : #DateFormat(Now(),"YYYY-MM-DD")#</p>' & CRLF>
	<cfset C=C & '<p class="reference" style="text-align: center;"><br /></p>' & CRLF>
  	<cfset C=C & '<p class="reference" style="text-align: center;"><br /></p>' & CRLF>
  	<cfset C=C & '<p class="reference" style="text-align: center;"><u><a href="http://Abertdupontel@hotmail.com/">Abert Dupontel</a></u></p>' & CRLF>
	<cfset C=C & '<p class="reference" style="text-align: center;"><br /></p>' & CRLF>
  	<cfset C=C & '<p class="reference" style="text-align: center;"><br /></p>' & CRLF>
	<cfset C=C & '<cfdocumentitem type="pagebreak"/>'>
	<cfset C=C & '<h2>Avertissement</h2>' & CRLF>
	<cfset C=C & 'Ce livre raconte une enquête policière étrange. C’est aussi une histoire romancée de mes ascendants. Julie de Bozonnier de Vaumane a réellement vécu. Elle est mon arrière-grand-mère paternelle.
Tous les événements historiques relatés dans les pages que vous allez lire sont réels. Les personnages ont existé, ainsi que les lieux. Bien sûr les dialogues sont inventés, les situations imaginées, les sentiments romancés.
' & CRLF>
	<cfset C=C & '</body>' & CRLF>
	<cfset C=C & '</html>' & CRLF>
	
	
	
	<!---  Construction et affichage du PDF --->
	<CFDOCUMENT format="PDF" 
				filename="#expandpath('MyPDF.pdf')#" 
				overwrite="Yes">
				#C#
	</CFDOCUMENT> 
	
	<cfheader name="Content-Disposition" 
		      value="attachment;filename=MyPDF.pdf"> 
	<cfcontent type="application/PDF"
			   file="#expandpath('MyPDF.pdf')#" 
			   deletefile="No"> 
			   
<!--- CFFILE-WRITE is unnecessary when you use deletefile="No" --->

	<!---  Ecriture du PDF --->
	<!---
	<CFFILE action="WRITE" 
			file="#DIR#/MyPDF.pdf"  
			output="#C#">  
			---> 
			
</CFOUTPUT>

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines