fpanaccia / Wkhtmltopdf.NetCore-deprecated

Rotativa + Net Core
The Unlicense
220 stars 94 forks source link

ExtendsOptionFlag #25

Closed YanchiHuang closed 4 years ago

YanchiHuang commented 4 years ago

HI, I want to expand the argument of Wkhtmltopdf. This is my rewrite. It can override from outside.

for example


public class PdfConvertOptions: ConvertOptions
{
    /// <summary>
    /// Change the dpi explicitly (this has noeffect on X11 based systems) (default 96)
    /// </summary>
    [OptionFlag("--dpi")]
    public int DPI { get; set; }

    /// <summary>
    /// Use print media-type instead of screen
    /// </summary>
    [OptionFlag("--print-media-type")]
    public bool PrintMediaType { get; set; }

    /// <summary>
    ///  Disable the intelligent shrinking strategy used by WebKit that makes the pixel/dpi ratio non-constant
    /// </summary>
    [OptionFlag("--disable-smart-shrinking")]
    public bool DisableSmartShrinking { get; set; }
}

Continue to use, I can enjoy new version of Wkhtmltopdf

_generatePdf.SetConvertOptions(getConvertOptions());
fpanaccia commented 4 years ago

Hi!, sorry for the delay....i did not see this PR, but i did something similar...so im gonna merge this changes and then push the one i made

gurustron commented 4 years ago

@YanchiHuang have you managed to make "--print-media-type" work? For me it has no effect despite definitely being present in switches.

YanchiHuang commented 4 years ago

@gurustron I try wkhtmltopdf v0.12.6 is work

.page {
  color: red;
}
@media print {
  .page {
    color: blue;
  }
}
gurustron commented 4 years ago

@YanchiHuang Thank you. Figured it out myself. For some reason other setup was producing different pdf's with styles wtih/without having no `@media print/screen specified, which still remains mystery for me))