We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Create pdf from doc

Hi,

We are trying to create the pdf from doc file which reads html file.
Below is code snippet we are using

string filename = DateTime.Now.ToString(“HH_mm_ss”);
string myDir = @“D:/HTMLTODOC/”;

Aspose.Words.Document wordDoc = new Aspose.Words.Document(myDir + “template-1.html”);
wordDoc.Save(myDir + filename + “.pdf”);

I am not able to attach html file so writing code below

Docx file gets created pretty fine but PDF has lot of margin every where, please try to generate the pdf from above code and html below

--------------HTML START--------------





@page {
size: A4;
margin: 0;
}

body
{
width: 900px;
}

/body table {
width: 100%;
}
/

@media print {
body {
margin: 0;
border: initial;
border-radius: initial;
width: initial;
min-height: initial;
box-shadow: initial;
background: initial;
page-break-after: always;
}
}










































































































REFERRING PRACTITIONER/Provider No



«ContactType»



436 Burwood Road

BELMORE NSW 2192

Ph: 1300 883 405 Fax: 02 9370 7290



Title



Surname



First



DOB



Sex



«Title»



«LastName»



«FirstName»



«Birthdate»



«xfGender»



Address: «Address 1»



Suburb: «City»



Post Code: «Postal Code»



State: «State»



Home Ph: «Phone1Link_RecID»



Work Ph: «Phone2Link_RecID»



Mobile: «Phone3Link_RecID»



Medicare Number: «xfMedicareNumber»



Medicare Assignment (Section 20A of the Health Insurance Act 1973) I assign my right to benefits to the approved Pathology Practitioner Who will render the requested pathology service(s)





Patients Signature:





Date:



The information provided by you on this form will be used to access the benefit payable for services rendered. Its collection is authorized by law and its contents may be disclosed to the Department of Health and Ageing, to the person claiming the benefit for the service or to the person’s nominee. The person making the claim may be advised of your eligibility under the scheme



Collected By



Date



Time



 



 



 





Account Type





Private





Bulk Billed

 



Clinical Notes/ Therapy



Tests Requested



LAB USE





Path for monitoring purposes.



Pt currently taking Bio identical Hormone Replacement Therapy.



No Need to Fast

Do not take morning dose prior to this test





ESTRADIOL

PROGESTERONE



TOTAL TESTOSTERONE

SHBG

CALCULATED FREE TESTOSTERONE



 



INSTRUCTIONS



Blood test preferably to be taken between 8am – 10am







Doctors Signature:



 







Date: «CreatedDateTime»


                     


 






------------HTML END------------

Please let me know what is issue.

Hi Ahmz,


Thanks for your inquiry. We have tested the scenario with your share HTML using Aspose.Words for .NET 17.6 and we are unable to notice margin issue in resultant PDF. Please download and try latest version of Aspose.Words for .NET, it will resolve the issue.

However, if you face any issue then please share your output and expected PDF documents here, we will further investigate the issue and will guide you accordingly.

Best Regards,