convert HTML to PDF

Reply
Occasional Contributor
Posts: 13

convert HTML to PDF

May i know if we Can read HTML file in sas and convert into PDF ? 

 

Currerntly Iam using third party tools like PDFMYURL.com and so on..

 

I just want read final output.html file and conver into pdf

 

 

Super User
Posts: 20,203

Re: convert HTML to PDF

Is the output.html file from SAS? Can you provide some more details?

 

There's no direct method, but if it's SAS output that can also be redirected to a PDF file. You can also use third party tools directly from SAS using the X/SYSEXEC command to call them.

Occasional Contributor
Posts: 13

Re: convert HTML to PDF

yes , the HTML output is from SAS

 

Basically I didn't wrote any html code inside the sas code , First we created the html_template and then we passed macro variable to the html.
 
 
1) SAS code : 
 
data send_to_html;
set input_table;
/* define the code to run for each observation */
/*  /sas/config/ma/Lev1/SASMA/test*/
&LBL_ADT.;
code = 'filename letter "location/filename.html" ' 
||'lrecl=32767 ; '
||'proc stream outfile=letter mod quoting=both;  '
||'begin '
||'&streamdelim; %include test(html_template.html); '
||';;;;'
/*  ||'filename letter clear;'*/
;
/* run the code */
rc = dosubl(code);
run;

 

 
 
2) html template example : shorrex_template.html
 
 
<!DOCTYPE html>
<html>
<head>
<title>&Name.</title>
</head>
<body>
 
<h1>&first_name.</h1>  /*macro variable from sas */
<h1>&last_name.</h1>
<p>&short_desc_1.</p>
<p>&short_desc_2_1.</p>
<p>&short_desc_3_1.</p>
 
 
 
</body>
</html>
Super User
Posts: 11,517

Re: convert HTML to PDF

The basic SAS output to PDF is ODS. You would place procedures that generate output between an ODS PDF destination statement and an ODS PDF Close statement.

 

ods pdf file="C:\path\myfile.pdf";

 

proc print data=sashelp.class;

run;

 

ods pdf close;

 

Would create the PDF file myfile.pdf in the folder C:\path and have the results of the proc print.

 

If you are writing raw html then this approach likely won't help.

Ask a Question
Discussion stats
  • 3 replies
  • 170 views
  • 0 likes
  • 3 in conversation