Inserting a PDF file as a resource, and displaying the pages? - visual-c++

I am using Visual C++, MFC, and would like to:
(a) Load a pdf file as a resource
(b) Display this file, and be able to move through the pdf file.
The reason why I would like to load the pdf as a resource, is that I do not want the User to be able to download the pdf file (at least not easily).
Can someone please help me?
All the best
Alex

You don't need to use ActiveX to accomplish what you want. Adding a custom binary resource to the resource file should be sufficient. This had been asked here and here.

As far as I know there are a couple of PDF OCX/ActiveX controls that allow you to view PDF files.
From Adobe itself there is an ActiveX COM Control. You should be able to add it into your toolbox and to drag it on a MFC dialog.
Also I found an older article on CodeProject

Related

How to download a text file displaying on web page

I am learning Algorithms 4th. And now I want to download a data file 1Mints.txt which is a input file for testing K-Sum algorithm. Thus, I search it on the book's website. Fortunately, I find the corresponding page but the file just display on line and I can not download it. I hope someone could help me. Thanks.
file link: https://algs4.cs.princeton.edu/14analysis/1Mints.txt
You can Download the file by below steps:
Open the Web page from which you want to extract text.
Click the “Right Click” menu.
Click the “Save as”, then in the “Filename” 1Mints.txt comes.
Then select “Save as Type” as “Text Document” and then Okay.
It will Download 1Mints.txt at the specified location.
When I found the following method to download it, I really think I am a foolish. You just right click the web page and chose save it.

Disable copy function in PDFTRON for Android

Is it possible to disable the copy option of the lib when selecting a text in the PDF using the PDFTron lib for Android?
I tried to search for the string, but also have not found it.
If you are using one of the mobile SDK's, or using our PDFViewWPF control for .Net 4+, then this is possible by modifying the tools code that is provided. There will one or two text selection tools, for which you can just comment out. Plus you would want to disable ctrl-c, and right click and select copy abilities. Exact code changes depends on platform. If you are using our older C++ PDFViewCtrl class this is harder to do, but I suspect you are not on this anyway.
Be aware though, there is no real way to prevent a user from extracting text from a PDF, since they can always open it in another PDF viewer and do it there.
See this form post for more info, including how to scramble the unicode values of text.
https://groups.google.com/forum/#!searchin/pdfnet-sdk/disable$20text/pdfnet-sdk/luWQmyhRDTw/z7UIGuu9uYkJ
Note, you will probably be interested in the PDFTron WebViewer technology, which provides much greater control over content. In particular, the original PDF file is never exposed to anyone for download. You can also encrypt the XOD file, so it cannot be opened in an XPS viewer, and you have full control over the UI, including disabling text search/extraction.
https://www.pdftron.com/webviewer/showcase/
https://www.pdftron.com/webviewer/index.html

How to insert an Image in WORD after a bookmark using OpenXML

I am using a word document which has a bookmark inside that. My requirment is to insert an icon after each bookmark using OpenXML 2.0 with C# 4.0.
I tried to use Image content control and the reflected code from OpenXMLSDK tool.
Somehow it got worked but now I am getting the full size controls. Also each image has an icon into that for change picture. Can anyone tell me that how can I reduce the size of the picture content control and if possible remove that extra icon.
Also, if anyone has better idea to insert the icon after each bookmark?
Somehow inserting an image using OpenXML is not that developer friendly.
Please help on this.
The best way to learn how to do something in Open XML is to use - Open XML SDK 2.0 Productivity Tool. You could insert the icons you need manually in MS Word first, save the document and them - open this file in Open XML SDK 2.0 Productivity Tool (which is a part of Open XML SDK 2.0). Then - find the bookmarks and icons you inserted and see how to do that programmaticaly:
Hope that helps!

Loading Image into Control button VC++ 2010

I am doing a dialog based application in VC++ 2010, where I am using different control buttons for different languages and I want to load different .png files into the button dynamically, But I am unable to load, please help me.
Look here for a good answer: http://www.functionx.com/visualc/controls/bmpbtn.htm
Hope this helps

MFC Application in VC++

I have developed a desktop application using MFC, which has FILE, EDIT, VIEW and HELP options,along with one pen to write on the opened document which saves as test1. It is allowing me to open only test1 or test2 etc. Apart from these types of files, if i want to open PPTs or PDFs how can i do it?
The code to open a file is autogenerated by Visual Studio 2008. Now i need to modify the same.
This is something Microsoft doesn't provide any Wizards to do (at least not directly). The basic idea is that you have to create and add new document and view classes for the new file types. Then you need to add document strings to the string table to describe the association between the file extensions and the document/view classes. Then you register each document/view pair in the app class using the strings you added to the string table.
By far the easiest way to do this is to generate the document, view, and string in another (otherwise throwaway) application, grab the document, view, registration string and registration code from that application and put them into your application. Then generate another throwaway application for the next file extension.
That gives you a skeleton doc/view for each file extension. From there, it's up to you to write the code to actually open, display, edit, save, etc., that type of file. That's not going to be trivial for either PDF or (especially) PPT -- unless you "delegate" and use something like an ActiveX control to do the real work. If you want to do that, the Adobe ActiveX control works reasonably well (somewhat limited capabilities, but it'll show up essentially the same as a PDF in a web browser). Offhand I don't remember whether MS provides an ActiveX control for viewing PPT files. There is a free PPT viewer, but if memory serves it's an executable, rather than a control.

Resources