La filigrana è il processo di aggiunta di un logo o di un altro segno identificativo a un file digitale. Lo scopo di una filigrana è identificare il proprietario del file, affermare il copyright, scoraggiare l'accesso non autorizzato ai tuoi contenuti e aggiungere il marchio alle tue risorse. Puoi anche utilizzare filigrane per tracciare l'origine di un file e impedire ad altri di rubare o utilizzare i tuoi contenuti senza autorizzazione. Esistono diversi modi per filigranare i contenuti digitali, il più comune è aggiungere un contrassegno visivo al file nel testo o nell'immagine, utilizzando un'app o un programma software.
L'automazione del processo lo renderebbe più efficiente se ti imbatti regolarmente in filigrane su più file di tipi diversi, risparmiando così un sacco di tempo e fatica. È qui che le API GroupDocs.Watermark per .NET e Java sono estremamente utili. Semplificano il processo di watermarking, aumentano l'efficacia e consentono di garantire la protezione delle immagini e dei documenti digitali. Puoi creare app C#, VB.NET e Java per aggiungere o rimuovere filigrane di tipi di testo e immagini in PDF, Word, Excel, PowerPoint, OpenDocument, Visio, Email, Rich Text e diversi formati di file immagine.
Per eseguire correttamente gli esempi di codice condivisi nelle sezioni successive e configurare il tuo ambiente di lavoro, assicurati di aver installato correttamente l'API GroupDocs.Watermark per .NET o versioni Java insieme a qualsiasi altro prerequisito.
Forniamo diverse opzioni di installazione per le versioni .NET e Java, consulta le informazioni condivise di seguito per ulteriore assistenza.
Puoi eseguire l'installazione tramite NuGet, scaricare direttamente il programma di installazione MSI o le DLL dalla sezione dei download oppure utilizzare la console di Gestione pacchetti:
Visita la sezione dei download per ottenere il file JAR oppure utilizza l'ultima configurazione Maven nelle tue app Java:
Dopo aver configurato correttamente GroupDocs.Watermark (per .NET o Java), è possibile esaminare alcuni dei casi d'uso più comuni di filigrana di documenti e immagini.
Le filigrane di testo sono un tipo di filigrana ampiamente utilizzato che può essere utilizzato per proteggere i contenuti sensibili nei file elaborati digitalmente. È possibile evitare la copia o la stampa non autorizzata di un file utilizzando filigrane basate su testo. Le API GroupDocs.Watermark consentono agli sviluppatori .NET e Java di integrare questa funzionalità nei loro moduli software esistenti o di creare applicazioni per interfacce web mobili o HTML che consentono agli utenti di usufruire senza sforzo delle funzionalità di filigrana del testo.
Se stai cercando di inserire filigrane basate su testo nei file di Word, per favore utilizzare il codice C# indicato di seguito:
WordProcessingLoadOptions loadOptions = new WordProcessingLoadOptions();
using (Watermarker watermarker = new Watermarker("path/sample.docx”, loadOptions))
{
TextWatermark watermark = new TextWatermark("Test watermark", new Font("Arial", 19));
Apply watermark settings
watermark.VerticalAlignment = VerticalAlignment.Center;
watermark.HorizontalAlignment = HorizontalAlignment.Center;
watermark.RotateAngle = 25.0;
watermark.ForegroundColor = Color.Red;
watermark.Opacity = 1.0;
WordProcessingWatermarkSectionOptions options = new WordProcessingWatermarkSectionOptions();
// Setting shape name
options.Name = "Shape 1";
// Set the descriptive (alternative) text to be associated with the shape
options.AlternativeText = "Test watermark";
watermarker.Add(watermark, options);
watermarker.Save("path/document-text-watermarked.docx”);
} Puoi anche aggiungere filigrane di testo nei documenti di Word utilizzando il seguente codice Java:
WordProcessingLoadOptions loadOptions = new WordProcessingLoadOptions();
Watermarker watermarker = new Watermarker(("path/sample.docx”, loadOptions);
TextWatermark watermark = new TextWatermark("Test watermark", new Font("Arial", 19));
//Apply watermark settings
watermark.setVerticalAlignment(VerticalAlignment.Center);
watermark.setHorizontalAlignment(HorizontalAlignment.Center);
watermark.setRotateAngle(25.0);
watermark.setForegroundColor(Color.getRed());
watermark.setOpacity(1.0);
WordProcessingWatermarkSectionOptions options = new WordProcessingWatermarkSectionOptions();
// Setting the shape name
options.setName("Shape 1");
// Set the descriptive (alternative) text to be associated with the shape
options.setAlternativeText("Test watermark");
watermarker.add(watermark, options);
watermarker.save(("path/document-text-watermarked.docx”);
watermarker.close(); L'utilizzo di immagini come filigrane è un ottimo modo per etichettare documenti legali o ufficiali in quanto sono più facili da aggiungere e difficili da rimuovere rispetto alle filigrane di testo. Le filigrane basate su immagini possono anche essere utilizzate in modo efficace per aggiungere marchi o altre informazioni a un documento. Le API GroupDocs.Watermark supportano più tipi di filigrane basate su immagini per i tuoi file PDF in .NET e Java.
Filigrana documenti PDF con etichette basate su immagini utilizzando il codice C# mostrato di seguito:
// Add image watermark to PDF file page(s)
PdfLoadOptions loadOptions = new PdfLoadOptions();
using (Watermarker watermarker = new Watermarker("path/sample.pdf", loadOptions))
{
ImageWatermark imageWatermark = new ImageWatermark("watermark-image.png")
{
// Setting watermark appearance
Opacity = 0.7,
X = 70,
Y = 350
};
// Adding image watermark to the second page (page index starts from zero)
PdfArtifactWatermarkOptions imageWatermarkOptions = new PdfArtifactWatermarkOptions();
imageWatermarkOptions.PageIndex = 1;
watermarker.Add(imageWatermark, imageWatermarkOptions);
watermarker.Save("path/image-watermarked.pdf");
} Per filigranare file PDF in Java con etichette immagine, utilizza questo codice di esempio:
// Apply Image Watermark to the second page of the PDF file
PdfLoadOptions loadOptions = new PdfLoadOptions();
Watermarker watermarker = new Watermarker("path/sample.pdf", loadOptions);
// Load image and set appearance
ImageWatermark imageWatermark = new ImageWatermark(Constants.LockPng);
imageWatermark.setOpacity(0.7);
imageWatermark.setX(130);
imageWatermark.setY(390);
// Add watermark image to the second page of the PDF file (page index starts at zero)
PdfArtifactWatermarkOptions imageWatermarkOptions = new PdfArtifactWatermarkOptions();
imageWatermarkOptions.setPageIndex(1);
watermarker.add(imageWatermark, imageWatermarkOptions);
imageWatermark.close();
// Save the watermarked PDF
watermarker.save("path/image-watermarked.pdf");
watermarker.close(); Microsoft Excel e PowerPoint sono due dei tipi di dati per fogli di calcolo e presentazioni più utilizzati. Gli utenti di tutto il mondo utilizzano ampiamente queste applicazioni software per report, dimostrazioni di prodotti e molti altri scopi. Le API GroupDocs.Watermark per .NET e Java consentono agli sviluppatori di app di filigranare a livello di programmazione entrambi questi tipi di file di dati con testo e immagini senza richiedere Microsoft Office.
Per inserire filigrane di testo o immagine nei fogli di calcolo Excel in .NET, utilizzare la seguente codifica di esempio C#:
SpreadsheetLoadOptions loadOptions = new SpreadsheetLoadOptions();
using (Watermarker watermarker = new Watermarker(“path/sample.xlsx”, loadOptions))
{
// Add text watermark to the first worksheet
TextWatermark textWatermark = new TextWatermark("Test watermark", new Font("Arial", 8));
SpreadsheetWatermarkShapeOptions textWatermarkOptions = new SpreadsheetWatermarkShapeOptions();
textWatermarkOptions.WorksheetIndex = 0;
watermarker.Add(textWatermark, textWatermarkOptions);
// Add image watermark to the second worksheet
using (ImageWatermark imageWatermark = new ImageWatermark(“watermark-image.jpg”))
{
SpreadsheetWatermarkShapeOptions imageWatermarkOptions = new SpreadsheetWatermarkShapeOptions();
imageWatermarkOptions.WorksheetIndex = 1;
watermarker.Add(imageWatermark, imageWatermarkOptions);
}
watermarker.Save(“path/text-image-watermarked.xlsx”);
}
//Similarly, please use this sample code if you are looking to watermark presentations in .NET:
PresentationLoadOptions loadOptions = new PresentationLoadOptions();
using (Watermarker watermarker = new Watermarker(“path/sample.pptx”, loadOptions))
{
// Add text watermark to the first slide
TextWatermark textWatermark = new TextWatermark("Test watermark", new Font("Arial", 8));
PresentationWatermarkSlideOptions textWatermarkOptions = new PresentationWatermarkSlideOptions();
textWatermarkOptions.SlideIndex = 0;
watermarker.Add(textWatermark, textWatermarkOptions);
// Add image watermark to the second slide
using (ImageWatermark imageWatermark = new ImageWatermark(“path/watermark-image.jpg”))
{
PresentationWatermarkSlideOptions imageWatermarkOptions = new PresentationWatermarkSlideOptions();
imageWatermarkOptions.SlideIndex = 1;
watermarker.Add(imageWatermark, imageWatermarkOptions);
}
watermarker.Save(“path/text-image-watermarked.pptx”);
} Utilizzare l'esempio di codice condiviso di seguito per applicare filigrane basate su testo o immagini ai fogli di calcolo Excel in Java:
SpreadsheetLoadOptions loadOptions = new SpreadsheetLoadOptions();
Watermarker watermarker = new Watermarker(“path/sample.xlsx”, loadOptions);
// Add text watermark to the first worksheet
TextWatermark textWatermark = new TextWatermark("Test watermark", new Font("Arial", 8));
SpreadsheetWatermarkShapeOptions textWatermarkOptions = new SpreadsheetWatermarkShapeOptions();
textWatermarkOptions.setWorksheetIndex(0);
watermarker.add(textWatermark, textWatermarkOptions);
// Add image watermark to the second worksheet
ImageWatermark imageWatermark = new ImageWatermark(“watermark-image.jpg”);
SpreadsheetWatermarkShapeOptions imageWatermarkOptions = new SpreadsheetWatermarkShapeOptions();
imageWatermarkOptions.setWorksheetIndex(1);
watermarker.add(imageWatermark, imageWatermarkOptions);
watermarker.save(“path/text-image-watermarked.xlsx”);
watermarker.close();
imageWatermark.close();
//And, to add text or image watermarks to presentations in Java, please use this code:
PresentationLoadOptions loadOptions = new PresentationLoadOptions();
Watermarker watermarker = new Watermarker(“path/samples.pptx”, loadOptions);
// Add text watermark to the first slide
TextWatermark textWatermark = new TextWatermark("Test watermark", new Font("Arial", 8));
PresentationWatermarkSlideOptions textWatermarkOptions = new PresentationWatermarkSlideOptions();
textWatermarkOptions.setSlideIndex(0);
watermarker.add(textWatermark, textWatermarkOptions);
// Add image watermark to the second slide
ImageWatermark imageWatermark = new ImageWatermark(“watermark-image.jpg”);
PresentationWatermarkSlideOptions imageWatermarkOptions = new PresentationWatermarkSlideOptions();
imageWatermarkOptions.setSlideIndex(1);
watermarker.add(imageWatermark, imageWatermarkOptions);
watermarker.save(“path/text-image-watermarked.pptx”);
watermarker.close();
imageWatermark.close(); Proprio come con diversi tipi di documenti, potresti anche dover aggiungere un identificatore alle tue immagini. A causa dell'immensa popolarità della condivisione di contenuti sulle piattaforme social, anche la filigrana delle foto è diventata sempre più importante per prevenire l'uso improprio. Gli utenti preferiscono incorporare filigrane di testo o immagini alle foto prima di pubblicarle sulla piattaforma social di loro scelta. Le API GroupDocs.Watermark forniscono una serie di strumenti per inserire facilmente etichette filigrana in file immagine PNG, JPG, TIFF e GIF nelle piattaforme .NET e Java.
Se stai cercando di filigranare le immagini aggiungendo etichette di testo, utilizza il codice C# mostrato di seguito che applica la filigrana a un'immagine JPG:
using (Watermarker watermarker = new Watermarker("filePath/sample-image.jpg"))
{
// Set the Text and Watermark Font
Font font = new Font ("Arial", 30, FontStyle.Bold | FontStyle.Italic);
TextWatermark watermark = new TextWatermark("Text Watermark", font);
// Set Watermark Properties
watermark.ForegroundColor = Color.Black;
watermark.TextAlignment = TextAlignment.Right;
watermark.X = 70;
watermark.Y = 70;
watermark.RotateAngle = -30;
watermark.Opacity = 0.4;
// watermark.BackgroundColor = Color.Blue;
// Apply the configured watermark to JPG Image
watermarker.Add(watermark);
watermarker.Save("filePath/text-watermarked.jpg");
} Puoi applicare filigrane alle tue foto e anche altre immagini in Java. Utilizza il seguente codice Java per filigranare un'immagine PNG:
TextWatermark watermark = new TextWatermark("Text Watermark", new Font("Arial", 30, FontStyle.Bold | FontStyle.Italic));
// Set Watermark properties
watermark.setForegroundColor(Color.getBlack());
watermark.setTextAlignment(TextAlignment.Right);
watermark.setRotateAngle(-30);
watermark.setOpacity(0.4);
watermark.setX(70);
watermark.setY(70);
// Apply Watermark to the source PNG Image
Watermarker watermarker = new Watermarker(“path/sample-image.png”);
watermarker.add(watermark);
watermarker.save(“path/text-watermarked.png”);
watermarker.close(); La ricerca e la rimozione delle filigrane esistenti dai documenti è un aspetto importante della pulizia o della disinfezione dei file oppure potrebbe essere un requisito aziendale. Considera lo scenario di eliminare il marchio obsoleto aggiunto alle tue risorse digitali e sostituirlo con la versione più recente. Con l'aiuto delle API GroupDocs.Watermark per .NET e Java, non solo puoi aggiungere diversi tipi di filigrane ai file di dati, ma anche cercare tra gli oggetti filigrana aggiunti e rimuoverli.
Per trovare la filigrana nei file Word, Excel, PowerPoint, PDF o Visio in .NET in base ad alcuni criteri specifici, utilizzare questo codice di esempio in C#:
using (Watermarker watermarker = new Watermarker(“path/sample.pdf”))
{
// Apply the exact text search string
TextSearchCriteria textSearchCriteria = new TextSearchCriteria("© 2019");
// Find all possible watermarks containing the specified text
PossibleWatermarkCollection possibleWatermarks = watermarker.Search(textSearchCriteria);
Console.WriteLine("Found {0} possible watermark(s)", possibleWatermarks.Count);
} Oltre a cercare le etichette filigrana esistenti dai tuoi file, puoi anche rimuoverle. Utilizza questa codifica C# per la rimozione della filigrana con la formattazione specificata:
using (Watermarker watermarker = new Watermarker(“path/sample.pdf”))
{
TextFormattingSearchCriteria criteria = new TextFormattingSearchCriteria();
criteria.ForegroundColorRange = new ColorRange();
criteria.ForegroundColorRange.MinHue = -5;
criteria.ForegroundColorRange.MaxHue = 10;
criteria.ForegroundColorRange.MinBrightness = 0.01f;
criteria.ForegroundColorRange.MaxBrightness = 0.99f;
criteria.BackgroundColorRange = new ColorRange();
criteria.BackgroundColorRange.IsEmpty = true;
criteria.FontName = "Arial";
criteria.MinFontSize = 19;
criteria.MaxFontSize = 42;
criteria.FontBold = true;
PossibleWatermarkCollection watermarks = watermarker.Search(criteria);
watermarks.Clear();
watermarker.Save(“path/watermark-removed.pdf”);
} Puoi cercare filigrane in documenti Word, PDF, Excel e PowerPoint in Java. Il seguente codice viene utilizzato per cercare filigrane su un criterio di ricerca testo:
Watermarker watermarker = new Watermarker(“path/sample.pdf”);
// Apply the exact text search string
TextSearchCriteria textSearchCriteria = new TextSearchCriteria("© 2019");
// Find all possible watermarks containing the specified text
PossibleWatermarkCollection possibleWatermarks = watermarker.search(textSearchCriteria);
System.out.println("Found " + possibleWatermarks.getCount() + " possible watermark(s)");
watermarker.close(); La rimozione di qualsiasi etichetta di filigrana esistente in Java è possibile anche con GroupDocs.Watermark per l'API Java. Questa codifica Java rimuove una filigrana con una formattazione specifica:
Watermarker watermarker = new Watermarker(“path/sample.pdf”);
TextFormattingSearchCriteria criteria = new TextFormattingSearchCriteria();
criteria.setForegroundColorRange(new ColorRange());
criteria.getForegroundColorRange().setMinHue(-5);
criteria.getForegroundColorRange().setMaxHue(10);
criteria.getForegroundColorRange().setMinBrightness(0.01f);
criteria.getForegroundColorRange().setMaxBrightness(0.99f);
criteria.setBackgroundColorRange(new ColorRange());
criteria.getBackgroundColorRange().setEmpty(true);
criteria.setFontName("Arial");
criteria.setMinFontSize(19);
criteria.setMaxFontSize(42);
criteria.setFontBold(true);
PossibleWatermarkCollection watermarks = watermarker.search(criteria);
watermarks.clear();
watermarker.save(“path/watermark-removed.pdf”);
watermarker.close(); Stai cercando di filigranare PDF, DOC, DOCX, XLS, XLSX, PPT, PPTX, VSD, MSG, EML, RTF, TXT, PNG, JPG, TIFF e altri file al volo utilizzando i tuoi dispositivi mobili? In caso affermativo, prova le nostre App di watermarking gratuite e goditi un'esperienza di watermarking eccezionale.
Puoi esportare facilmente i dati in Microsoft Excel da varie fonti disponibili come JSON e CSV.
Continua a leggereSi dispone di diverse cartelle di lavoro di Excel e si desidera combinarle insieme in un unico file per la creazione di report o per conservare i dati in un'unica posizione
Continua a leggereLa conversione di documenti Word inclusi DOC o DOCX in .NET è un requisito molto comune
Continua a leggere