Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Generating pdf from htmldocument in c# code chnages the font size of the content in pdf

New Here ,
Mar 22, 2020 Mar 22, 2020

Hi,

 

I have specified a font size in css class and same is used in htmldocument,

Trying to generate a pdf in c# code for the htmldocument.

 

I have provided 26px as font size but after generating a pdf, the font size reduces to 24 px.

Similarly for 24px, the pdf shows content in 21 px.

 

Why there is such discrepancy ?

TOPICS
Create PDFs , Edit and convert PDFs , PDF forms
1.0K
Translate
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
New Here ,
Mar 23, 2020 Mar 23, 2020

Also, at times it increases the font size.

I had given 13px and in pdf it got changed to 16px.

 

Sometimes it reduces and at times increased. Why does that happen ??

Translate
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
Community Expert ,
Mar 23, 2020 Mar 23, 2020

How does you create the documents?

Translate
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
New Here ,
Mar 23, 2020 Mar 23, 2020

HtmlToPdfDocument

 above class is used with specifying the outputformat as

GlobalSettings.DocumentOutputFormat.PDF

 

var document = new HtmlToPdfDocument

 

{

GlobalSettings =

{

ProduceOutline = true,

DocumentTitle = "ClinDoc Notes-" + updatedDoc.id,

 

PaperSize = System.Drawing.Printing.PaperKind.Letter,

Margins = marginSettings,

OutputFormat = GlobalSettings.DocumentOutputFormat.PDF,

},

Objects = {

new ObjectSettings {

 

HtmlText = htmlStr,    // this is the htmlcontent

FooterSettings = footerSettings,

CountPages = true,

ProduceExternalLinks = true,

WebSettings = new WebSettings

 

{

LoadImages = true,

PrintMediaType = true,

DefaultEncoding = "utf8",

PrintBackground = true,

 

}

}

}

 

 

Translate
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
New Here ,
Mar 23, 2020 Mar 23, 2020

html content had the font size spcified

Translate
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
Community Expert ,
Mar 23, 2020 Mar 23, 2020

Why does you post this in the forum for Adobe Acrobat?

Translate
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
New Here ,
Mar 23, 2020 Mar 23, 2020

bceuae this is a html to pdf conversion.

So while creating html, we r specifying a proper font size but when it gets converted to pdf, it shows wrong font size

Translate
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 ,
Mar 23, 2020 Mar 23, 2020

That doesn’t answer the question. This forum is for people using Adobe Acrobat. Perhaps you aren’t aware that PDF is a public standard and anyone can make software to work with PDF files, without Acrobat. You need to contact support for the product you are using to do the conversion. If it’s some free.open source thing you found you may have to fix it yourself. 

Translate
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
Community Expert ,
Mar 23, 2020 Mar 23, 2020
LATEST

Adobe Acrobat shows the font size which are in the PDF file.

Translate
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