Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.
Options

How to load a document (PDF or other) and convert it to bytes?

Hello,

I know that my question is not Hololens Specific, but I have the problem just with the Hololens/Hololens Emulator and that is why I ask it there.

I want to load a PDF document, and to convert it to bytes.

My PDF is called "test.pdf".
I tried to load it using:
var filepath = "C:/.../test.pdf"
File.ReadAllBytes(filepath);

and the filepath does not exist.
I tried writing "file:///C:/.../test.pdf", filepath doesn't exist either.
I tried using Application.dataPath and Application.persistantDataPath too.

So I changed and decided to use Resources.Load. I put my pdf document in my "Resources" browser. I tried:
Resources.Load("test.pdf");
Resources.Load("test");
I renamed my pdf to pdf.bytes after reading this on a forum, without result.

So if you have clues, I will be grateful.

Thank you!

Tagged:

Answers

  • Options

    @Frimy

    Here is an example of deploying and reading a simple text based file on HoloLens that might give you something to experiment with.

    For reference a good place to start digging on the subject in the docs (if you haven't done so already) would be to start with this page.

    Most of the file access specifics are based on the UWP file access approach, so researching and becoming familiar with reading files for UWP apps should also help.

    Windows Holographic User Group Redmond

    WinHUGR.org - - - - - - - - - - - - - - - - - - @WinHUGR
    WinHUGR YouTube Channel -- live streamed meetings

  • Options

    Thank you for your answer, I check that. I already use:

    Load(await PdfDocument.LoadFromStreamAsync(new MemoryStream(myTextAsset.bytes).AsRandomAccessStream()));

    for documents from url or as public variable, and it's okay. That is why I didn't see why it does not works with a local document.

Sign In or Register to comment.