Access Tools in Save Menu with C# - c#

I use C# to turn ppt files into jpg images but I also want the program to resave the same ppt with compressed pictures and cropped pictures, I want to use settings in Tools menu when saving a file. How can I access them with Microsoft.Office.Interop.PowerPoint?
Sorry, I should clarify. I want to re-save the same ppt but with those settings of compression and cropping. Basically, I want to resave the ppt file and then break it into images. I need a ppt with compressed images in order to save space on the pc.
Right now I use this to save JPGs.
file.SaveCopyAs(outputPath + "CONVERTED.jpg", PowerPoint.PpSaveAsFileType.ppSaveAsJPG, MsoTriState.msoTrue);

I may have an answer for you:
In the PPTX file's PPT folder, you'll find a presProps.xml file.
In it, you'll find something like this:
<p:extLst>
<p:ext uri="{E76CE94A-603C-4142-B9EB-6D1370010A27}">
<p14:discardImageEditData xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" val="0"/>
</p:ext>
<p:ext uri="{D31A062A-798A-4329-ABDD-BBA856620510}">
<p14:defaultImageDpi xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" val="96"/>
</p:ext>
<p:ext uri="{FD5EFAAD-0ECE-453E-9831-46B23BE46B34}">
<p15:chartTrackingRefBased xmlns:p15="http://schemas.microsoft.com/office/powerpoint/2012/main" val="1"/>
</p:ext>
</p:extLst>
From this, it appears that you could save a copy of the PPTX, change defaultImageDPI and possibly discardImageEditData in the XML, re-open and resave the PPTX from PPT.
It doesn't seem to allow values below 96dpi; set it lower and it reverts to 96 when you open the file in PPT.

Related

Prevent PDFsharp from saving an image file?

I have prevented my program from saving images downloaded as files. (They are saved in Image variables instead). However, my application is slowed down significantly because the PDFsharp libraries save the image files anyway before drawing them to the PDF document. This is done deep within a hierarchy of calls by its functions.
Is there a simple fix to get around this?
JPEG images are simply copied into the PDF file, all other image formats have to be converted to the PDF format. AFAIK PDFsharp does not save the images to the local file system, however they are saved into a memory stream during the conversion.
There is a simple fix to get around this: write a better conversion and submit it to the PDFsharp team.
I think PDFSharp always need to save first. It cannot handle byte image that will used to import an image. I recently encountered it when I also coded and used pdfsharp. My process is to save an image then import to code in pdfsharp. I have a part that I need to delete all temporary images.

save a file in memory instead of a physical path

I am trying to use Office Interop assembly to export a PowerPoint slide to an image. The SaveAs(), SaveCopyAs(), and Export() methods all accept a physical path as the output folder.
I want to put it in memory for further processing instead of creating a bunch of images on disks that I have to clear them later.
How can I export a slide and hold it in the memory temporarily instead of saving it in a physical folder?
Calling the Slide's .Copy method will put the slide on the clipboard in a number of formats, including PNG, GIF, JPG, DIB, BMP and metafile/enhanced metafile.
It should be possible to access the format you want from there.
There is no way of writing an Office Apps files straight to memory. You can look at Open XML SDK for Office, but i think, it will be easier if you just save the image to a file and load it through memorystream.

Embed image in file

I'm trying to figure out a way to embed an image into a file in c#.
What I'm doing is to create a file with text inside of it (it uses XML) , and I want a quite big image embedded into it which I then can read from the file along with the XML.
But how do I do that?
I can't put an image file along with the file since the file may be used on different computers and I don't want 100's of image files laying around with the files.
Any ideas would be appreciated!

C#/Powerpoint add-in file select and "store"

For one part of the add-in I am creating I would like to add a video file. I am not necessarily trying to show the video in powerpoint, but I need to place this file somewhere for later reference.
So a) can I store the file within the powerpoint file, or b) if I have a relatively positioned file (same folder) could I then access the file easily?
I will be getting the file name from file open dialog.
If you want to embed the you could use the following code to add a new shape containing the video and hide it.
Dim shape As shape
Set shape = Slide.Shapes.AddMediaObject(videofile, 0, 0, -1, -1)
shape.Visible = msoFalse
However, it can be tricky to retrieve the video file later. See How to export movie from Powerpoint 2010 and VBA Export embedded video from Powerpoint presentation.
Or you could read the video data and store it in a slide or shape tag which might be an overkill depending on what you are trying to achieve.
Surely, you could copy the video file to the same directory as the PPT file but it will be lost if you move the PPT file or send it by mail etc.

appending images

I have a number of images that I would like to append to each other to make a larger file.
I am not sure of the best way to do this and I am looking for suggestions. The resulting image would be either printed, saved to a file or copied to the clipboard.
Save them as one tiff file have look to thisSave images into a multi-page TIFF file or add images to an existing TIFF file

Categories

Resources