locked
Help with breaking richtextbox contents into pages

    Question

  • Say I have an rtf file.  I can display the contents of the rtf file in a richtextbox, yes?  What I'm trying to achieve is somehow take bitmap snapshot of each page that would be printed out.

    How would I do this? 

    Please be patient with me as I'm a fake programmer.

    Thursday, July 31, 2014 2:14 PM

Answers

  • Hi,

    I have to say yes because Windows Store App does not have existing APIs for creating/writing content to PDF file. And I can understand that situation, I know if you want to implement that function, lot of codes are required, that's why some third party code are on sale.

    Simply search on the Internet, I can find some pdf writer for help. This link might give you some idea: http://stackoverflow.com/questions/11109427/looking-for-a-pdf-writer-for-windows-8-metro-apps

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, August 4, 2014 9:41 AM
    Moderator

All replies

  • Hi fake programmer,

    Yes, you can definitely display the contents of rtf file in a richtextbox.

    But I'm not quite understand how you break the richtexbox contents into pages, but if you can do this, we do have a API named RenderTargetBitmap class, by which you can give a screenshot for the current visual stuff.

    Before you print the stuff, you can take screenshots for the visual contents of the richtextbox and pass them to the print page preview. For printing sample, ref: http://code.msdn.microsoft.com/windowsapps/Print-Sample-c544cce6

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Friday, August 1, 2014 2:59 AM
    Moderator
  • Well, I'm trying to export a doc to pdf?  I can already convert doc or docx to everything else like rtf, dot, html, etc.  My searches keep coming up with someone saying this is impossible.  But what if I can render the content, screenshot it, and insert images into pdf?  I can already insert stuff into pdf. 

    It's for an LOB app.  People in my company wants to be able to export to pdf so it's faster to just email people directly proposals, approvals, etc.  We're an engineering firm, and I'm the closest thing to a programmer... which I'm not.  If you see my code, your head will explode.  It's a complete mess.


    • Edited by RandyPete Saturday, August 2, 2014 2:15 PM
    Saturday, August 2, 2014 2:12 PM
  • Hi,

    I have to say yes because Windows Store App does not have existing APIs for creating/writing content to PDF file. And I can understand that situation, I know if you want to implement that function, lot of codes are required, that's why some third party code are on sale.

    Simply search on the Internet, I can find some pdf writer for help. This link might give you some idea: http://stackoverflow.com/questions/11109427/looking-for-a-pdf-writer-for-windows-8-metro-apps

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Monday, August 4, 2014 9:41 AM
    Moderator