libreliodev / windows8

Windows 8 Customizable Reader - Librelio Digital Publishing Suite
www.librelio.com
9 stars 25 forks source link

Implement PDF reader #3

Closed deepiksdev closed 11 years ago

deepiksdev commented 11 years ago

The PDF reader has the following features:

deepiksdev commented 11 years ago

Subject to other suggestions by developer, we suggest to use the muPDF library

deepiksdev commented 11 years ago

@voyagerj :

I start working on PDF reader module, but fail in some difficulty. You suggest to use muPDF library. But it seems it will much more difficult to use it for our project than I expect - this is pure c++ library, not managed code. To attach it to W8 project I'll have to wrote at least 2 layers - 1 layer on c++ to make sort of managed dll, and other layer (or wrapper) on c#.

I found several projects that do the same, but I'm not sure that it's will useful for us and cover all our needs (I found projects pdfviewer and MuPDFlib, I check at least MuPDFlib - and it as really poor functionality - it allow only to convert full pdf file to tiff).

Do you able to give me more info why you suggest to use muPDF? Or it is possible will be better to find one of the existing c# solution for pdf viewing (PDFsharp (MIT License) or iTextSharp (LGPL / MPL)).

It seems that PDFSharp is not intended for rendering pdf files, only for creating pdf.

voyagerj commented 11 years ago

Yes it seems both ((PDFsharp/ iTextSharp) only PDF creators and cant render pdf. Now I'm looking other libraries (ImageResizer, Aspose.Pdf, ...). I'll let you know if I found one that cover all our need. At worse case I'll start working with muPDF.

deepiksdev commented 11 years ago

OK, thanks.

voyagerj commented 11 years ago

It seems I'll use muPDF even if I'm going to use another library. Further investigations show that most of C# libraries for PDF processing based either on Ghostscript or MuPDF (if I'm right - fork of the Ghostscript). For now I start to work based on pdfviewer-win32 project and add any absent functionality we need. This project also based on muPDF. Build error fixed.

voyagerj commented 11 years ago

It seems we facing unexpected difficulties during implementing PDF module. All libraries I've tries to use can't be used in Windows Store application. It seems that MS significantly redesign their security policy, API support and something else - but in fact, many of existing solutions (not only for PDF support) can't be used in Windows Store application.

PDFsharp - can't render PDF file. Doesn't support .NETCore platform. iTextSharp - can't render PDF file. Doesn't support .NETCore platform. Aspose.Pdf - there is no free version so I stopp further investigation. But it seems it's not support Windows Store application type. ImageResizer - based on Ghostscript solution most oriented for the server-side solutions. It suport .NET Framework up to 4.5 - but not support .NET Core. mupdf-converter (http://mupdf-converter.googlecode.com) - has very stricted functionality and can't be used in Windows Store application pdfviewer-win32 (http://pdfviewer-win32.googlecode.com/svn/trunk) - originally support only only .NET 3.5. Even when I finally was able to compile this library to support .NET 4 - I found that I can't use it in Windows Store application

I also tried rather nice workaround - using Acrobat Reader plugin & WebBrowser. It is working fine either in W7 or in W8 (but not as Windows Store application - as normal desktop application or in W7 compatibility mode)m\, but it seems MS doesn't support WebBrowser in Windows Store application.

So for now I still don't have any solution that will work in Windows Store application. I still have some ideas (see bellow) but if you have some other ideas or suggestion - I would like to hear it.

Next things I'm going to test :

deepiksdev commented 11 years ago

try to use "pdf-js" solution (inside WebView component). We need to make sure that PDF files such as the Wind magazine files are correctly rendered, which would surprise me. try to use Acrobat Reader plugin inside WebView (WebView luckily supported by Windows Store application type). We will have no control on navigation and no way to get links => I don't think it can work. try to make .NETCore port from muPDF sources (can't say right now how many time it will take me - but looks like most complicated case). This was the original solution. check http://www.pdfeight.com/ PDF reader solution (it seems they support W8, but need to check if it suport Windows Store application type and cover all our needs). I don't think they provide an API. I also looking trhough the paid solutions (for now I find only "Foxit Embedded PDF SDK" that support WinRT & Win8 Store app). I have contacted Foxit. But I think it will be very expensive.

voyagerj commented 11 years ago

rwf

try to make .NETCore port from muPDF sources (can't say right now how many time it will take me - but looks like most complicated case). l> This was the original solution. Actually, I've suppose to use existing library to implement PDF view module. But, muPDF library can't be used in .NET application (like in Android solution). Existing .NET ports of muPDF doesn't support .NET Core platform. But make a port of muPDF library to a new platform - this is much more difficulty task than implement PDF render module based on existing solution. Especially in case if new platform - Managed .NET platform with Core profile that doesn't allow to use even C (not C++) files (most of muPDF library - pure C code).

Only way how to use muPDF library I can see right now - make a full port to c# (or specific version of C++ language: WinRT C++ or C++/CX). But I'm afraid this is not a task for the single developer at all. On a first glance- this is several developers and a months of work.

Sorry it is look like mostly my fail - I really doesn't expect that Windows Store application doesn't compatible even with .NET Framework solutions and pay less attention to project technical review from this point of view.

Today I made several tests for creation .NET C++ libraries compatible with Windows Store application and looking through the MuPDF library - results looks not very good. My point of view I describe above.

I also checked previously noted "Foxit Embedded PDF SDK" - it is really compatible with Windows Store application and allow me to render page and give an access to the embedded URLs. Only 1 major limitation - price (and I'm not sure we'll able to use it in open source solution).

I still not finished investigation of pdf.js. They promise that it is "efficient renderer without native code assistance" - but I need some more time to make several test and try to insert this solution in Windows Store application.

moskvin commented 11 years ago

Hi guys.

I have a few questions to @voyagerj.

  1. Which way do you use to build mupdf?
  2. Did you try following way?: http://www.codeproject.com/Articles/16541/Create-your-Proxy-DLLs-automatically It is similar way used in android.

I have achieved with muPDF:

  1. I compiled dynamic-library muPDF (by MSV11, MSV8 and mingw).
  2. I created by MSV11 MuPDF Wrapper Proxy-DLL, but I did not finish it.

@voyagerj Have you tried this way? Is It possible?

voyagerj commented 11 years ago

HI! No I doesn't need proxy dll so as we have full sources of muPDF dll. Finally I've used C++/CLI wrapper (to use it in managed solutions). And C# wraper over this dll. But the problem is that you can't attach such solution (DLL) to the Windows Store application. Actually you can use only .winmd created with .NET Core target. http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/aecf4846-6eca-444a-beb7-d4ba9d6ad754/

moskvin commented 11 years ago

@voyagerj I'm just upset. It was a surprise for me. Are only way a pdf-js?

libreliodev commented 11 years ago

@moskvin : pdf.js is actually not really an option, based on what I read on the internet. So it seems that the only option that we have is Foxit. Otherwise, we will need to parse the pdf server side. cc @voyagerj

voyagerj commented 11 years ago

@libreliodev : Could you please say more detailed why pdf.js not acceptable? I still can't resolve some problems with it (can't run it locally and allow to read local pdf file, only some pdf files shown correctly) but in general as a solution it is working in Windows Store application - I can send you a small demo application to show how it it look like.

I think about server-side parsing pdf in some other format - but not sure if it is aceptable for you.

deepiksdev commented 11 years ago

@voyagerj I read on Stack Overflow and other sites that:

I am interested in seeing you demo app.

I am also thinking about a server side solution. Your recommendations will be welcome.

libreliodev commented 11 years ago

@voyagerj As agreed, we will finally use bitmap images representing pages, and a json file containing all the links. All these elements will be embedded in a zip file. Features should be the same as with pdf. More details will be provided later, the work is in progress.

deepiksdev commented 11 years ago

Updated and replaced by #9