Updates

ComPDFKit PDF SDK 1.6.0 — Edit PDF Content Directly

By ComPDFKit | Wed. 07 Dec. 2022
PDF SDKRelease

In version 1.6.0, ComPDFKit PDF SDK released new features — Editing PDF text and images. Supported development platforms include iOS, Android, and Windows. It enables companies to integrate PDF editing into various apps or systems. And ComPDFKit makes it possible for the app’s end users to edit PDF text and images directly.

 

We will show you why we need these advanced features. Then, you can follow our code samples to edit PDF content with the ComPDFKit PDF library.

 

 

Why Edit PDF Content?

 

Everything has two sides. We all know that stability is the most special part for PDF files. When the number of users reaches a certain level, the stability becomes the bottleneck of the PDF format. So, the needs of editing PDF content appear.

 

There are a few PDF SDK manufacturers like ComPDFKit that developed the features to edit PDFs like Word. With ComPDFKit, you could turn to the editing mode to edit the content. If you finish your editing and exit the editing mode, the PDF will be stable again.

 

 

Edit the Text & Images in PDFs

 

We often get mad when we are checking a PDF file and want to change a few text or images. Because of the stability of PDF formats, we can’t edit in the past. Now, things have changed a lot. It comes out with the SDK for editing PDF text and images directly. If you are an app owner, these will be advanced features for your end users.

 

The text in a PDF could be changed with ComPDFKit including text size, color, alignment, and the place. The new text could be added when you call the interface SetMouseMode(MouseModes.PDFEdit). After we turn PDF to the editing mode, all the text areas will be editable. You can select some text and do the operations you want like coping and pasting.

 

When you are in editing mode, the images can also be editable. In ComPDFKit PDF SDK, the supported operations contain rotating, scaling, mirroring, cropping, extracting, replacing, coping, resizing, etc.

 

 

Sample Code

 

Here is the sample code on iOS, Android, and Windows platforms to do some operations on text and images.

 

Objective-C

[self setEditingSelectionFontSize:14.0];
[self setEditingSelectionFontColor:[CPDFKitPlatformColor redColor]];
[self setCurrentSelectionAlignment:NSTextAlignmentCenter];

 

Java

//Get the configuration items of editing.
CPDFEditConfig.Builder builder = editManager.getEditConfigBuilder();
//Set the required configuration items.
CPDFEditConfig config = builder.setCursorColor(Color.BLUE)
.setCursorWidth(10f)
.setDefalutBoardWidth(5f)
.setDefalutBoardColor(Color.RED)
.build();
//Update the configuration items.
editManager.updateEditConfig(config);

 

C#

viewer.PDFEditCommandHandler += Viewer_PDFEditCommandHandler;
private void Viewer_PDFEditCommandHandler(object sender, TextEditCommand e)
{
    e.Handle = true;
    e.PopupMenu = new ContextMenu();
    e.PopupMenu.Items.Add(new MenuItem() { Header = "Copy", Command = ApplicationCommands.Copy, CommandTarget = (UIElement)sender });
    e.PopupMenu.Items.Add(new MenuItem() { Header = "Cut", Command = ApplicationCommands.Cut, CommandTarget = (UIElement)sender });
    e.PopupMenu.Items.Add(new MenuItem() { Header = "Paste", Command = ApplicationCommands.Paste, CommandTarget = (UIElement)sender });
    e.PopupMenu.Items.Add(new MenuItem() { Header = "Delete", Command = ApplicationCommands.Delete, CommandTarget = (UIElement)sender });
    e.PopupMenu.Items.Add(new MenuItem() { Header = "Select All", Command = ApplicationCommands.SelectAll, CommandTarget = (UIElement)sender });
}

 

 

Conclusion

 

Check our documentation page to get more feature details. Please contact us to get the price information and have a free trial. We will keep optimizing and providing the best PDF SDK for our customers.