PDFStream not working

Posted by: el_pinkyto on 8 September 2017, 3:24 pm EST

  • Posted 8 September 2017, 3:24 pm EST

    Hi, I'm using an old version of Spread for windows forms (5.0.3518.2008). I'm trying to use PDFStream while printing, but i can't get the stream while debuging, the length is always 0. I've read that i should use the "safrepint" method, but is not available in the version i'm using.

    I hope you can help me.


    Thanks in advance.

    Dim stream As New MemoryStream
    Dim prinset As New FarPoint.Win.Spread.PrintInfo()
    prinset.ShowColor = True
    prinset.PrintToPdf = True
    prinset.ShowBorder = False
    prinset.Margin.Left = 30
    prinset.Margin.Top = 50
    prinset.UseSmartPrint = True
    prinset.Centering = FarPoint.Win.Spread.Centering.Horizontal
    prinset.PdfStream = Stream
    prinset.PdfWriteTo = FarPoint.Win.Spread.PdfWriteTo.Stream
    FpSpread1.Sheets(0).PrintInfo = prinset
    FpSpread1.PrintSheet(0)
  • Marked as Answer

    Replied 8 September 2017, 3:24 pm EST

    Hi,

    SafePrint is available in version 5 (it's hidden, so you need to type ".SafePrint(" to see the arguments, which are FpSpread instance and sheet index):

    // FarPoint.Win.Spread.FpSpread
    [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)]
    public void SafePrint(FpSpread spread, int sheet);

    SafePrint method will do the printing in the stream synchronously in the same thread, rather than creating a separate thread (which is why using the PrintSheet method doesn't work for this case).

    Regards,
    -Sean
  • Replied 8 September 2017, 3:24 pm EST

    Perfect! Thanks a lot.
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels