如何使用PdfBox删除可选内容组(OCG)

时间:2019-07-09 19:54:38

标签: java pdfbox

我正在使用PdfBox(2.0.16)(以前是在iText中)迁移我们的Pdf库。我正在尝试按照How to delete an optional content group alongwith its content from pdf using pdfbox?删除OCG 但是我做不到。

pdf文件是由iText生成的。

    public static class ApiHelper
    {
        public static HttpClient ApiClient { get; set; } 

        public static void InitializeClient()
        {
            ApiClient = new HttpClient();
            ApiClient.DefaultRequestHeaders.Accept.Clear();
            ApiClient.DefaultRequestHeaders.Accept.Add(new 
            MediaTypeWithQualityHeaderValue("application/json"));
        }
    }

    public class MovieGetter
    {
        public static async Task<Movie> LoadMovie(int movieId)
        {
            string url = "";
            url = $"https://api.themoviedb.org/3/movie/{ movieId } api_key=da521929456d16e8 ";

            using (HttpResponseMessage response = await 
            ApiHelper.ApiClient.GetAsync(url))
            {
                 Movie movie = await response.Content.ReadAsAsync<Movie>();
                 return movie;
            }

  App.xaml
    <Application x:Class="Api.App"

        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:Api"
        StartupUri="MainWindow.xaml">
     <Application.Resources>

     </Application.Resources>
    </Application>

打开生成的Pdf文件时出错。任何帮助都将不胜感激。

0 个答案:

没有答案