I'm developing a powerpoint vsto addin and I'm trying to export a specific slide as an image using Slide.Export method, But the problem is, the Export method is not embedding fonts. The generated image always have system installed font. Below is the code snippet i'm using:
private void SaveSlideAsImage(Slide slide, string filePath, float w, float h)
{
if (File.Exists(filePath))
File.Delete(filePath);
slide.Export(filePath, "jpg", (int)w, (int)h);
}
Can anyone help me how I can export a specific slide as image an which should have embedded font ?
Update
This is how the slide look like before export:
And this is how it look like after export. So you can see text is not matching and it could be because of embedded font
Update 2:
I have copied the only slide and then exported it. Now text is exported fine but now you can see font is different then the font in slide
and this is what i manually save and exported from powerpoint save as. Everything looks exact match of what's in slide:
Related
I am creating a small tool like text editor. I am fetching fonts from system and applying to text written on editor.
string fontName = (string)Fonttype.SelectedItem;
RichTextControl.Selection.ApplyPropertyValue(
System.Windows.Controls.RichTextBox.FontFamilyProperty, fontName);
But font installed like STMSaradha.ttf(Bengali font) won't show properly on RichTextBox, some text will get combined and don't show properly. Any suggestions?
Screenshot:
Is it possible to use Excel's Camera Tool with EPPlus? that is: programatically copy a range of cells from one sheet and paste them as a drawing object into another sheet?
Update:
I noticed that Excel's Camera Tool simply creates a picture with a formula. The formula is the range of cells to be watched/observed by Excel. If any of these cells change the picture is updated by Excel.
But with EPPlus is not possible to inject a formula to a Picture object, eg:
var picture = worksheet.Drawings.AddPicture("picture", (FileInfo)null);
picture.SetPosition(1, 0, 1, 0);
picture.Formula = "A1:D9"; // ...there is no "Formula" property for ExcelPicture object
Any workaround?
Bad news when I record a VBA Macro and replay it, it doesn't work. This is the syntax thats generated:
Range("A2").Select
Selection.Copy
ActiveSheet.Shapes.AddShape(, 355.5, 32.25, 72#, 72#).Select
ActiveSheet.Shapes.Range(Array("Picture 3")).Select
Application.CutCopyMode = False
Working with Images in Excel via automation is limited. You are pretty much limited to Shapes (or shudder - clipboard):
Set shp = ws.Shapes.AddPicture("C:\You.png", msoFalse, msoTrue, l, t, w, h)
shp.Name = strPic
shp.ScaleHeight Factor:=1, RelativeToOriginalSize:=msoTrue
shp.ScaleWidth Factor:=1, RelativeToOriginalSize:=msoTrue
What I am suggesting is create a screenshot of the selected cell and workaround it that way.
'Select the cells you want to copy to image
Range("A2").Select
'Copy selected cells contents to clipboard as image
Selection.CopyPicture Appearance:=xlScreen, Format:=xlPicture
'Choose destination
Range("B3").Select
'Paste
ActiveSheet.Paste
'Restore previous clipboard to memory
Hopefully the above will be enough to help you get it working in EPPPlus.
ps Converting VBA to C# is really easy, and it should be
trivial converting the above to EPPPlus: https://stackoverflow.com/a/34055947/495455
I have a richtextbox and by far, i have been successful in converting plain text into pdf using iTextsharp. Now, the situation is, when i copy some text from any source let's say a website and along text, it contains images. Now when i try to convert the content (text + images) into pdf, resulting pdf doesn't show images. I know that there would be some property to be set for the richtextbox or using itextsharp so to have images as well. I also know that we can insert images by giving path to that image but this is not what i want. I want to have plain text along with images while direct conversion from richtextbox to pdf. Forexample i have,![Im resulting pdf i want the same as in richtextbox][1]: http://i.stack.imgur.com/ts0ec.jpg
How can i have the same as in richtextbox? How can i specify orientation for text and image to be justified?
I need to get all the GIF pictures inside of a PowerPoint presentation (2007 and 2010) using interop and c#, but the shape.PictureFormat.GetType() does not contain any useful information, any idea?
When user adds an image the original file name (with extension) is saved by default into shape "alt text" (right click on shape /size and position / alternative text).
But the user can change it, so for some images you could haven't the data.
Instead, if you have control over image inserting you could store that information into a specific shape.tag property and then read it later.
I'm trying to replace a section of a PDF with different text. From research on all major PDF libraries for .NET, it seems this is complicated and not a trivial task. I think it may be easier to convert the PDF to an image, replace the text (always in the same place), then convert it back to a PDF (or leave it as an image if converting back isn't possible). Is it possible to extract an image from a PDF page with .NET?
If your text is in a known location, you can simply cover it with a rectangle filled with the background color, and then draw your text over top.
Note that the text will still be there, it simply won't be visible. Someone selecting text will still pick up the old stuff. If that's acceptable, it's quite trivial.
If the PDF was created from image, you can import it into Photoshop to edit it as an graphic. Or you can use screenshot program like "Snagit" to capture pdf page as image and use snagit's editor to erase old text and replace new one.
But this method may bring you problem is that the new added text may not the same font as text around it. Personally, I use pdf editor to replace text in pdf since the added text will be automatically fit with the original font and size.