PDFS in R

Our first example will be the pdf in the file “PDFexamples/N1343969.pdf,” which is a four page U.N. document your browser hopefully displays here:

Our first example pdf

pdftools package

library(pdftools)

The key command is pdf_text.

pdffilename <- "PDFexamples/N1343969.pdf"
text_pdftools <- pdf_text(pdffilename)

This gives us a vector of strings, one per page. To look at page 2, you look at the second item in the vector:

options(width=150)
text_pdftools[2]
[1] "A/RES/68/4                                Declaration of the High-level Dialogue on International Migration and Development\n                  6.     Recognize the need to strengthen synergies between international\n           migration and development at the global, regional and national levels;\n                  7.     Recognize the efforts made by the international community in addressing\n           relevant aspects of international migration and development, through different\n           initiatives, both within the United Nations system and in other processes,\n           particularly the Global Forum on Migration and Development and regional\n           processes, as well as in drawing on the expertise of the International Organization\n           for Migration and other member agencies of the Global Migration Group;\n                  8.     Acknowledge the important contribution of migration in realizing the\n           Millennium Development Goals, and recognize that human mobility is a key factor\n           for sustainable development which should be adequately considered in the\n           elaboration of the post-2015 development agenda;\n                  9.     Acknowledge the important role that migrants play as partners in the\n           development of countries of origin, transit and destination and recognize the need to\n           improve public perceptions of migrants and migration;\n                  10. Reaffirm the need to promote and protect effectively the human rights\n           and fundamental freedoms of all migrants, regardless of their migration status,\n           especially those of women and children, and to address international migration\n           through international, regional or bilateral cooperation and dialogue and through a\n           comprehensive and balanced approach, recognizing the roles and responsibilities of\n           countries of origin, transit and destination in promoting and protecting the human\n           rights of all migrants, and avoiding approaches that might aggravate their\n           vulnerability;\n                  11. Recognize that women and girls account for almost half of all\n           international migrants at the global level, and the need to address the special\n           situation and vulnerability of migrant women and girls by, inter alia, incorporating a\n           gender perspective into policies and strengthening national laws, institutions and\n           programmes to combat gender-based violence, including trafficking in persons and\n           discrimination against women and girls;\n                  12. Emphasize in this regard the need to establish appropriate measures for\n           the protection of women migrant workers in all sectors, including those involved in\n           domestic work;\n                  13. Express the commitment to protect the human rights of migrant children,\n           given their vulnerability, particularly unaccompanied migrant children, and to\n           provide for their health, education and psychosocial development, ensuring that the\n           best interests of the child are a primary consideration in policies of integration,\n           return and family reunification;\n                  14. Emphasize the need to respect and promote international labour\n           standards as appropriate, and respect the rights of migrants in their workplaces;\n                  15. Note the contribution of applicable international conventions, including\n           the International Convention on the Protection of the Rights of All Migrant Workers\n           and Members of Their Families, 1 to the international system for the protection of\n           migrants;\n           _______________\n           1\n             United Nations, Treaty Series, vol. 2220, No. 39481.\n2/4\n"

Let’s split that on the newline character and look at a few:

library(stringr)
text_pdftools_2_lines <- str_split(text_pdftools[2],"\\n")[[1]]
text_pdftools_2_lines[1:10]
 [1] "A/RES/68/4                                Declaration of the High-level Dialogue on International Migration and Development"
 [2] "                  6.     Recognize the need to strengthen synergies between international"                                  
 [3] "           migration and development at the global, regional and national levels;"                                          
 [4] "                  7.     Recognize the efforts made by the international community in addressing"                           
 [5] "           relevant aspects of international migration and development, through different"                                  
 [6] "           initiatives, both within the United Nations system and in other processes,"                                      
 [7] "           particularly the Global Forum on Migration and Development and regional"                                         
 [8] "           processes, as well as in drawing on the expertise of the International Organization"                             
 [9] "           for Migration and other member agencies of the Global Migration Group;"                                          
[10] "                  8.     Acknowledge the important contribution of migration in realizing the"                              

This seems to get all of the text out, top to bottom – including headers, page numbers, and “Please recycle” at the end of page 1.

tabulizer package

Let’s try the tabulizer package.

library(tabulizer)

We can try the extract_text command:

text_tabulizer <- extract_text(pdffilename)
text_tabulizer
[1] " United Nations A/RES/68/4 \n \nGeneral Assembly Distr.: General 21 January 2014 \nSixty-eighth session \nAgenda item 21 (e) \n \n13-43969 \n*1343969* Please recycle  \n \nResolution adopted by the General Assembly on 3 October 2013 \n[without reference to a Main Committee (A/68/L.5)] \n68/4. Declaration of the High-level Dialogue on International \nMigration and Development \n \n \n The General Assembly \n Adopts the following declaration: \n \nDeclaration of the High-level Dialogue on International Migration \nand Development \n We, representatives of States and Governments, gathered at United Nations \nHeadquarters in New York on 3 and 4 October 2013 on the occasion of the High-\nlevel Dialogue on International Migration and Development, \n 1. Recognize that international migration is a multidimensional reality of \nmajor relevance for the development of countries of origin, transit and destination, \nand in this regard recognize that international migration is a cross-cutting \nphenomenon that should be addressed in a coherent, comprehensive and balanced \nmanner, integrating development with due regard for social, economic and \nenvironmental dimensions and respecting human rights; \n 2. Acknowledge the important contribution made by migrants and migration \nto development in countries of origin, transit and destination, as well as the complex \ninterrelationship between migration and development; \n 3. Decide to work towards an effective and inclusive agenda on \ninternational migration that integrates development and respects human rights by \nimproving the performance of existing institutions and frameworks, as well as \npartnering more effectively with all stakeholders involved in international migration \nand development at the regional and global levels; \n 4. Reaffirm our commitment to address the opportunities and the challenges \nthat international migration presents to countries of origin, transit and destination; \n 5. Recognize the need for international cooperation to address, in a holistic \nand comprehensive manner, the challenges of irregular migration to ensure safe, \norderly and regular migration, with full respect for human rights; \nA/RES/68/4 Declaration of the High-level Dialogue on International Migration and Development\n \n2/4 \n 6. Recognize the need to strengthen synergies between international \nmigration and development at the global, regional and national levels; \n 7. Recognize the efforts made by the international community in addressing \nrelevant aspects of international migration and development, through different \ninitiatives, both within the United Nations system and in other processes, \nparticularly the Global Forum on Migration and Development and regional \nprocesses, as well as in drawing on the expertise of the International Organization \nfor Migration and other member agencies of the Global Migration Group; \n 8. Acknowledge the important contribution of migration in realizing the \nMillennium Development Goals, and recognize that human mobility is a key factor \nfor sustainable development which should be adequately considered in the \nelaboration of the post-2015 development agenda; \n 9. Acknowledge the important role that migrants play as partners in the \ndevelopment of countries of origin, transit and destination and recognize the need to \nimprove public perceptions of migrants and migration; \n 10. Reaffirm the need to promote and protect effectively the human rights \nand fundamental freedoms of all migrants, regardless of their migration status, \nespecially those of women and children, and to address international migration \nthrough international, regional or bilateral cooperation and dialogue and through a \ncomprehensive and balanced approach, recognizing the roles and responsibilities of \ncountries of origin, transit and destination in promoting and protecting the human \nrights of all migrants, and avoiding approaches that might aggravate their \nvulnerability; \n 11. Recognize that women and girls account for almost half of all \ninternational migrants at the global level, and the need to address the special \nsituation and vulnerability of migrant women and girls by, inter alia, incorporating a \ngender perspective into policies and strengthening national laws, institutions and \nprogrammes to combat gender-based violence, including trafficking in persons and \ndiscrimination against women and girls; \n 12. Emphasize in this regard the need to establish appropriate measures for \nthe protection of women migrant workers in all sectors, including those involved in \ndomestic work; \n 13. Express the commitment to protect the human rights of migrant children, \ngiven their vulnerability, particularly unaccompanied migrant children, and to \nprovide for their health, education and psychosocial development, ensuring that the \nbest interests of the child are a primary consideration in policies of integration, \nreturn and family reunification; \n 14. Emphasize the need to respect and promote international labour \nstandards as appropriate, and respect the rights of migrants in their workplaces; \n 15. Note the contribution of applicable international conventions, including \nthe International Convention on the Protection of the Rights of All Migrant Workers \nand Members of Their Families,1 to the international system for the protection of \nmigrants; \n_______________ \n1 United Nations, Treaty Series, vol. 2220, No. 39481. \nDeclaration of the High-level Dialogue on International Migration and Development A/RES/68/4 \n \n3/4 \n 16. Strongly condemn the acts, manifestations and expressions of racism, \nracial discrimination, xenophobia and related intolerance against migrants and the \nstereotypes often applied to them, including on the basis of religion or belief, and \nurge States to apply and, where needed, reinforce the existing laws when \nxenophobic or intolerant acts, manifestations or expressions against migrants occur, \nin order to eradicate impunity for those who commit those acts; \n 17. Reiterate our commitment to prevent and combat trafficking in persons, \nprotect victims of trafficking, prevent and combat migrant smuggling and protect \nmigrants from exploitation and other abuses, stress the need to establish or upgrade, \nas appropriate, national and regional anti-human trafficking policies and to reinforce \ncooperation on prevention, the prosecution of traffickers and the protection of \nvictims of trafficking, and encourage Member States to ratify, accede to and \nimplement relevant international instruments on preventing and combating \ntrafficking in persons and smuggling of migrants; \n 18. Encourage Member States to cooperate on mobility programmes that \nfacilitate safe, orderly and regular migration, including through labour mobility; \n 19. Recognize the particular vulnerabilities, circumstances and needs of \nadolescents and young migrants, as well as their potential to build social, economic \nand cultural bridges of cooperation and understanding across societies; \n 20. Recognize also all efforts made by Governments, all relevant bodies, \nagencies, funds and programmes of the United Nations system, other relevant \nintergovernmental, regional and subregional organizations, including the International \nOrganization for Migration and other organizations within the Global Migration \nGroup, and non-governmental stakeholders, including the private sector, in addressing \ninternational migration and development for the benefit of both migrants and \nsocieties; and bearing this goal in mind, further emphasize the need to strengthen \npartnerships among all relevant stakeholders; \n 21. Stress the need to deepen the interaction between Governments and civil \nsociety to find responses to the challenges and the opportunities posed by \ninternational migration, and recognize the contribution of civil society, including \nnon-governmental organizations, to promoting the well-being of migrants and their \nintegration into societies, especially at times of extreme vulnerable conditions, and \nthe support of the international community to the efforts of such organizations; \n 22. Acknowledge the complexity of migratory flows and that international \nmigration movements also occur within the same geographical regions, and in this \ncontext call for a better understanding of migration patterns across and within regions; \n 23. Recognize the importance of coordinated efforts of the international \ncommunity to assist and support migrants stranded in vulnerable situations and \nfacilitate, and cooperate on when appropriate, their voluntary return to their country \nof origin, and call for practical and action-oriented initiatives aimed at identifying \nand closing protection gaps; \n 24. Underline the right of migrants to return to their country of citizenship, \nand recall that States must ensure that their returning nationals are duly received; \n 25. Recognize the need to consider the role that environmental factors may \nplay in migration; \n 26. Recognize the necessity to consider how the migration of highly skilled \npersons, especially in the health, social and engineering sectors, affects the \ndevelopment efforts of developing countries, and emphasize the need to consider \ncircular migration; \nA/RES/68/4 Declaration of the High-level Dialogue on International Migration and Development\n \n4/4 \n 27. Recognize that remittances constitute an important source of private \ncapital, and reaffirm the need to promote conditions for cheaper, faster and safer \ntransfers of remittances in both source and recipient countries; \n 28. Emphasize the need for reliable statistical data on international \nmigration, including, when possible, on the contributions of migrants to \ndevelopment in both countries of origin and countries of destination; this data could \nfacilitate the design of evidence-based policy- and decision-making in all relevant \naspects of sustainable development; \n 29. Acknowledge that the Global Forum on Migration and Development has \nproved to be a valuable forum for holding frank and open discussions and that it has \nhelped to build trust among participating stakeholders through the exchange of \nexperiences and good practices and by virtue of its voluntary, informal State-led \ncharacter; \n 30. Acknowledge that the United Nations system can benefit from the \ndiscussions and outcomes of the Global Forum on Migration and Development, in \norder to maximize the benefits of international migration for development; \n 31. Call upon all relevant bodies, agencies, funds and programmes of the \nUnited Nations system, other relevant intergovernmental, regional and subregional \norganizations, including the International Organization for Migration and other Global \nMigration Group members, and the Special Representative of the Secretary-General \non International Migration and Development, within their respective mandates, to \nstrengthen their collaboration and cooperation to better and fully address the issue of \ninternational migration and development, in order to adopt a coherent, comprehensive \nand coordinated approach, and to consider migration issues in their contributions to \nthe preparatory process that will establish the post-2015 development agenda; \n 32. Welcome the recent efforts made by the Global Migration Group to take \nmeasures to enhance its functioning and to promote coherence and coordination \namong its member organizations, and in this regard stress the importance of regular \ninteraction between the Group and Member States; \n 33. Request the Secretary-General to continue his substantive work on \ninternational migration and development and, in collaboration with the United \nNations system and relevant organizations, including the International Organization \nfor Migration, to continue to assess the progress made in the field of migration and \ndevelopment; \n 34. Also request the Secretary-General, in the elaboration of his report on \ninternational migration and development to be submitted to the General Assembly at \nits sixty-ninth session, to give due consideration to the results and deliberations of \nthis High-level Dialogue. \n \n25th plenary meeting \n3 October 2013 \n \n"

That returns ONE BIG STRING for the whole document. To get page 2, you would have to do something like extract the substring between the first and second instance of the header.

We get less horizontal white space than with pdftools. Note that the page numbers now appear near the beginning of each page, and the “Please recycle” is in the 8th (??) line of page 1. So that’s going to be tricky to notice and get rid of.

Tabulizer is most useful when extracting a table from a pdf.

textreadr

Let’s try textreadr, part of the tidyverse.

library(textreadr)
text_textreader_pdf <- read_pdf(pdffilename)

This comes out as a dataframe, one row per page:

text_textreader_pdf
Table: [4 x 3]

  page_id element_id text                                    
1 1       1          United Nations                          
2 2       1          A/RES/68/4                              
3 3       1          Declaration of the High-level Dialogue o
4 4       1          A/RES/68/4                           Dec
. ...     ...        ...                                      

This is, however, just a wrapper for pdf_text of pdftools, so the text is identical. So, with slightly different syntax, we can extract the same 10 lines of page 2 as we did with pdftools.

str_split(text_textreader_pdf$text[2],"\\n")[[1]][1:10]
 [1] "A/RES/68/4                                Declaration of the High-level Dialogue on International Migration and Development"
 [2] "                  6.     Recognize the need to strengthen synergies between international"                                  
 [3] "           migration and development at the global, regional and national levels;"                                          
 [4] "                  7.     Recognize the efforts made by the international community in addressing"                           
 [5] "           relevant aspects of international migration and development, through different"                                  
 [6] "           initiatives, both within the United Nations system and in other processes,"                                      
 [7] "           particularly the Global Forum on Migration and Development and regional"                                         
 [8] "           processes, as well as in drawing on the expertise of the International Organization"                             
 [9] "           for Migration and other member agencies of the Global Migration Group;"                                          
[10] "                  8.     Acknowledge the important contribution of migration in realizing the"                              

xpdf and pdftotext

If you’re on a unix-based system, you can install a standalone utility called xpdf which comes with my favorite tool for this purpose, pdftotext.

cd PDFexamples
pdftotext N1343969.pdf N1343969_straight.txt
pdftotext -raw N1343969.pdf N1343969_raw.txt
pdftotext -layout N1343969.pdf N1343969_lo.txt
pdftotext -f 2 -l 3 N1343969.pdf N1343969_pp23.txt

pdftotext -x 72 -y 72 -W 468 -H 648 -f 2 -l 2 N1343969.pdf N1343969_crop.txt

cd ..

With no option flags (pdftotext N1343969.pdf N1343969_straight.txt) pdftotext returns:

straighttext <- readLines("PDFexamples/N1343969_straight.txt")
incomplete final line found on 'PDFexamples/N1343969_straight.txt'
straighttext
  [1] "A/RES/68/4"                                                                                                                            
  [2] ""                                                                                                                                      
  [3] "United Nations"                                                                                                                        
  [4] ""                                                                                                                                      
  [5] "Distr.: General"                                                                                                                       
  [6] "21 January 2014"                                                                                                                       
  [7] ""                                                                                                                                      
  [8] "General Assembly"                                                                                                                      
  [9] "Sixty-eighth session"                                                                                                                  
 [10] "Agenda item 21 (e)"                                                                                                                    
 [11] ""                                                                                                                                      
 [12] "Resolution adopted by the General Assembly on 3 October 2013"                                                                          
 [13] "[without reference to a Main Committee (A/68/L.5)]"                                                                                    
 [14] ""                                                                                                                                      
 [15] "68/4. Declaration of the High-level Dialogue on International"                                                                         
 [16] "Migration and Development"                                                                                                             
 [17] "The General Assembly"                                                                                                                  
 [18] "Adopts the following declaration:"                                                                                                     
 [19] ""                                                                                                                                      
 [20] "Declaration of the High-level Dialogue on International Migration"                                                                     
 [21] "and Development"                                                                                                                       
 [22] "We, representatives of States and Governments, gathered at United Nations"                                                             
 [23] "Headquarters in New York on 3 and 4 October 2013 on the occasion of the Highlevel Dialogue on International Migration and Development,"
 [24] "1."                                                                                                                                    
 [25] "Recognize that international migration is a multidimensional reality of"                                                               
 [26] "major relevance for the development of countries of origin, transit and destination,"                                                  
 [27] "and in this regard recognize that international migration is a cross-cutting"                                                          
 [28] "phenomenon that should be addressed in a coherent, comprehensive and balanced"                                                         
 [29] "manner, integrating development with due regard for social, economic and"                                                              
 [30] "environmental dimensions and respecting human rights;"                                                                                 
 [31] "2."                                                                                                                                    
 [32] "Acknowledge the important contribution made by migrants and migration"                                                                 
 [33] "to development in countries of origin, transit and destination, as well as the complex"                                                
 [34] "interrelationship between migration and development;"                                                                                  
 [35] "3."                                                                                                                                    
 [36] "Decide to work towards an effective and inclusive agenda on"                                                                           
 [37] "international migration that integrates development and respects human rights by"                                                      
 [38] "improving the performance of existing institutions and frameworks, as well as"                                                         
 [39] "partnering more effectively with all stakeholders involved in international migration"                                                 
 [40] "and development at the regional and global levels;"                                                                                    
 [41] "4."                                                                                                                                    
 [42] "Reaffirm our commitment to address the opportunities and the challenges"                                                               
 [43] "that international migration presents to countries of origin, transit and destination;"                                                
 [44] "5."                                                                                                                                    
 [45] "Recognize the need for international cooperation to address, in a holistic"                                                            
 [46] "and comprehensive manner, the challenges of irregular migration to ensure safe,"                                                       
 [47] "orderly and regular migration, with full respect for human rights;"                                                                    
 [48] "13-43969"                                                                                                                              
 [49] ""                                                                                                                                      
 [50] "*1343969*"                                                                                                                             
 [51] ""                                                                                                                                      
 [52] "Please recycle"                                                                                                                        
 [53] ""                                                                                                                                      
 [54] "\fA/RES/68/4"                                                                                                                          
 [55] ""                                                                                                                                      
 [56] "Declaration of the High-level Dialogue on International Migration and Development"                                                     
 [57] ""                                                                                                                                      
 [58] "6."                                                                                                                                    
 [59] "Recognize the need to strengthen synergies between international"                                                                      
 [60] "migration and development at the global, regional and national levels;"                                                                
 [61] "7."                                                                                                                                    
 [62] "Recognize the efforts made by the international community in addressing"                                                               
 [63] "relevant aspects of international migration and development, through different"                                                        
 [64] "initiatives, both within the United Nations system and in other processes,"                                                            
 [65] "particularly the Global Forum on Migration and Development and regional"                                                               
 [66] "processes, as well as in drawing on the expertise of the International Organization"                                                   
 [67] "for Migration and other member agencies of the Global Migration Group;"                                                                
 [68] "8."                                                                                                                                    
 [69] "Acknowledge the important contribution of migration in realizing the"                                                                  
 [70] "Millennium Development Goals, and recognize that human mobility is a key factor"                                                       
 [71] "for sustainable development which should be adequately considered in the"                                                              
 [72] "elaboration of the post-2015 development agenda;"                                                                                      
 [73] "9."                                                                                                                                    
 [74] "Acknowledge the important role that migrants play as partners in the"                                                                  
 [75] "development of countries of origin, transit and destination and recognize the need to"                                                 
 [76] "improve public perceptions of migrants and migration;"                                                                                 
 [77] "10. Reaffirm the need to promote and protect effectively the human rights"                                                             
 [78] "and fundamental freedoms of all migrants, regardless of their migration status,"                                                       
 [79] "especially those of women and children, and to address international migration"                                                        
 [80] "through international, regional or bilateral cooperation and dialogue and through a"                                                   
 [81] "comprehensive and balanced approach, recognizing the roles and responsibilities of"                                                    
 [82] "countries of origin, transit and destination in promoting and protecting the human"                                                    
 [83] "rights of all migrants, and avoiding approaches that might aggravate their"                                                            
 [84] "vulnerability;"                                                                                                                        
 [85] "11. Recognize that women and girls account for almost half of all"                                                                     
 [86] "international migrants at the global level, and the need to address the special"                                                       
 [87] "situation and vulnerability of migrant women and girls by, inter alia, incorporating a"                                                
 [88] "gender perspective into policies and strengthening national laws, institutions and"                                                    
 [89] "programmes to combat gender-based violence, including trafficking in persons and"                                                      
 [90] "discrimination against women and girls;"                                                                                               
 [91] "12. Emphasize in this regard the need to establish appropriate measures for"                                                           
 [92] "the protection of women migrant workers in all sectors, including those involved in"                                                   
 [93] "domestic work;"                                                                                                                        
 [94] "13. Express the commitment to protect the human rights of migrant children,"                                                           
 [95] "given their vulnerability, particularly unaccompanied migrant children, and to"                                                        
 [96] "provide for their health, education and psychosocial development, ensuring that the"                                                   
 [97] "best interests of the child are a primary consideration in policies of integration,"                                                   
 [98] "return and family reunification;"                                                                                                      
 [99] "14. Emphasize the need to respect and promote international labour"                                                                    
[100] "standards as appropriate, and respect the rights of migrants in their workplaces;"                                                     
[101] "15. Note the contribution of applicable international conventions, including"                                                          
[102] "the International Convention on the Protection of the Rights of All Migrant Workers"                                                   
[103] "and Members of Their Families, 1 to the international system for the protection of"                                                    
[104] "migrants;"                                                                                                                             
[105] ""                                                                                                                                      
[106] "_______________"                                                                                                                       
[107] "1"                                                                                                                                     
[108] ""                                                                                                                                      
[109] "2/4"                                                                                                                                   
[110] ""                                                                                                                                      
[111] "United Nations, Treaty Series, vol. 2220, No. 39481."                                                                                  
[112] ""                                                                                                                                      
[113] "\fDeclaration of the High-level Dialogue on International Migration and Development"                                                   
[114] ""                                                                                                                                      
[115] "A/RES/68/4"                                                                                                                            
[116] ""                                                                                                                                      
[117] "16. Strongly condemn the acts, manifestations and expressions of racism,"                                                              
[118] "racial discrimination, xenophobia and related intolerance against migrants and the"                                                    
[119] "stereotypes often applied to them, including on the basis of religion or belief, and"                                                  
[120] "urge States to apply and, where needed, reinforce the existing laws when"                                                              
[121] "xenophobic or intolerant acts, manifestations or expressions against migrants occur,"                                                  
[122] "in order to eradicate impunity for those who commit those acts;"                                                                       
[123] "17. Reiterate our commitment to prevent and combat trafficking in persons,"                                                            
[124] "protect victims of trafficking, prevent and combat migrant smuggling and protect"                                                      
[125] "migrants from exploitation and other abuses, stress the need to establish or upgrade,"                                                 
[126] "as appropriate, national and regional anti-human trafficking policies and to reinforce"                                                
[127] "cooperation on prevention, the prosecution of traffickers and the protection of"                                                       
[128] "victims of trafficking, and encourage Member States to ratify, accede to and"                                                          
[129] "implement relevant international instruments on preventing and combating"                                                              
[130] "trafficking in persons and smuggling of migrants;"                                                                                     
[131] "18. Encourage Member States to cooperate on mobility programmes that"                                                                  
[132] "facilitate safe, orderly and regular migration, including through labour mobility;"                                                    
[133] "19. Recognize the particular vulnerabilities, circumstances and needs of"                                                              
[134] "adolescents and young migrants, as well as their potential to build social, economic"                                                  
[135] "and cultural bridges of cooperation and understanding across societies;"                                                               
[136] "20. Recognize also all efforts made by Governments, all relevant bodies,"                                                              
[137] "agencies, funds and programmes of the United Nations system, other relevant"                                                           
[138] "intergovernmental, regional and subregional organizations, including the International"                                                
[139] "Organization for Migration and other organizations within the Global Migration"                                                        
[140] "Group, and non-governmental stakeholders, including the private sector, in addressing"                                                 
[141] "international migration and development for the benefit of both migrants and"                                                          
[142] "societies; and bearing this goal in mind, further emphasize the need to strengthen"                                                    
[143] "partnerships among all relevant stakeholders;"                                                                                         
[144] "21. Stress the need to deepen the interaction between Governments and civil"                                                           
[145] "society to find responses to the challenges and the opportunities posed by"                                                            
[146] "international migration, and recognize the contribution of civil society, including"                                                   
[147] "non-governmental organizations, to promoting the well-being of migrants and their"                                                     
[148] "integration into societies, especially at times of extreme vulnerable conditions, and"                                                 
[149] "the support of the international community to the efforts of such organizations;"                                                      
[150] "22. Acknowledge the complexity of migratory flows and that international"                                                              
[151] "migration movements also occur within the same geographical regions, and in this"                                                      
[152] "context call for a better understanding of migration patterns across and within regions;"                                              
[153] "23. Recognize the importance of coordinated efforts of the international"                                                              
[154] "community to assist and support migrants stranded in vulnerable situations and"                                                        
[155] "facilitate, and cooperate on when appropriate, their voluntary return to their country"                                                
[156] "of origin, and call for practical and action-oriented initiatives aimed at identifying"                                                
[157] "and closing protection gaps;"                                                                                                          
[158] "24. Underline the right of migrants to return to their country of citizenship,"                                                        
[159] "and recall that States must ensure that their returning nationals are duly received;"                                                  
[160] "25. Recognize the need to consider the role that environmental factors may"                                                            
[161] "play in migration;"                                                                                                                    
[162] "26. Recognize the necessity to consider how the migration of highly skilled"                                                           
[163] "persons, especially in the health, social and engineering sectors, affects the"                                                        
[164] "development efforts of developing countries, and emphasize the need to consider"                                                       
[165] "circular migration;"                                                                                                                   
[166] "3/4"                                                                                                                                   
[167] ""                                                                                                                                      
[168] "\fA/RES/68/4"                                                                                                                          
[169] ""                                                                                                                                      
[170] "Declaration of the High-level Dialogue on International Migration and Development"                                                     
[171] ""                                                                                                                                      
[172] "27. Recognize that remittances constitute an important source of private"                                                              
[173] "capital, and reaffirm the need to promote conditions for cheaper, faster and safer"                                                    
[174] "transfers of remittances in both source and recipient countries;"                                                                      
[175] "28. Emphasize the need for reliable statistical data on international"                                                                 
[176] "migration, including, when possible, on the contributions of migrants to"                                                              
[177] "development in both countries of origin and countries of destination; this data could"                                                 
[178] "facilitate the design of evidence-based policy- and decision-making in all relevant"                                                   
[179] "aspects of sustainable development;"                                                                                                   
[180] "29. Acknowledge that the Global Forum on Migration and Development has"                                                                
[181] "proved to be a valuable forum for holding frank and open discussions and that it has"                                                  
[182] "helped to build trust among participating stakeholders through the exchange of"                                                        
[183] "experiences and good practices and by virtue of its voluntary, informal State-led"                                                     
[184] "character;"                                                                                                                            
[185] "30. Acknowledge that the United Nations system can benefit from the"                                                                   
[186] "discussions and outcomes of the Global Forum on Migration and Development, in"                                                         
[187] "order to maximize the benefits of international migration for development;"                                                            
[188] "31. Call upon all relevant bodies, agencies, funds and programmes of the"                                                              
[189] "United Nations system, other relevant intergovernmental, regional and subregional"                                                     
[190] "organizations, including the International Organization for Migration and other Global"                                                
[191] "Migration Group members, and the Special Representative of the Secretary-General"                                                      
[192] "on International Migration and Development, within their respective mandates, to"                                                      
[193] "strengthen their collaboration and cooperation to better and fully address the issue of"                                               
[194] "international migration and development, in order to adopt a coherent, comprehensive"                                                  
[195] "and coordinated approach, and to consider migration issues in their contributions to"                                                  
[196] "the preparatory process that will establish the post-2015 development agenda;"                                                         
[197] "32. Welcome the recent efforts made by the Global Migration Group to take"                                                             
[198] "measures to enhance its functioning and to promote coherence and coordination"                                                         
[199] "among its member organizations, and in this regard stress the importance of regular"                                                   
[200] "interaction between the Group and Member States;"                                                                                      
[201] "33. Request the Secretary-General to continue his substantive work on"                                                                 
[202] "international migration and development and, in collaboration with the United"                                                         
[203] "Nations system and relevant organizations, including the International Organization"                                                   
[204] "for Migration, to continue to assess the progress made in the field of migration and"                                                  
[205] "development;"                                                                                                                          
[206] "34. Also request the Secretary-General, in the elaboration of his report on"                                                           
[207] "international migration and development to be submitted to the General Assembly at"                                                    
[208] "its sixty-ninth session, to give due consideration to the results and deliberations of"                                                
[209] "this High-level Dialogue."                                                                                                             
[210] "25th plenary meeting"                                                                                                                  
[211] "3 October 2013"                                                                                                                        
[212] ""                                                                                                                                      
[213] "4/4"                                                                                                                                   
[214] ""                                                                                                                                      
[215] "\f"                                                                                                                                    

The -raw option flag provides the text in the order it appears in the “content stream” of the pdf file … in other words, not necessarily in the order a human entered them or that you would read them. This may be useful, but probably not. In any case, with pdftotext -raw N1343969.pdf N1343969_raw.txt you get slightly different output, especially with regard to the headers and footers:

rawtext <- readLines("PDFexamples/N1343969_raw.txt")
incomplete final line found on 'PDFexamples/N1343969_raw.txt'
rawtext
  [1] "United Nations A/RES/68/4"                                                                     
  [2] "General Assembly Distr.: General"                                                              
  [3] "21 January 2014"                                                                               
  [4] "Sixty-eighth session"                                                                          
  [5] "Agenda item 21 (e)"                                                                            
  [6] "13-43969"                                                                                      
  [7] "*1343969* Please recycle"                                                                      
  [8] "Resolution adopted by the General Assembly on 3 October 2013"                                  
  [9] "[without reference to a Main Committee (A/68/L.5)]"                                            
 [10] "68/4. Declaration of the High-level Dialogue on International"                                 
 [11] "Migration and Development"                                                                     
 [12] "The General Assembly"                                                                          
 [13] "Adopts the following declaration:"                                                             
 [14] "Declaration of the High-level Dialogue on International Migration"                             
 [15] "and Development"                                                                               
 [16] "We, representatives of States and Governments, gathered at United Nations"                     
 [17] "Headquarters in New York on 3 and 4 October 2013 on the occasion of the High-"                 
 [18] "level Dialogue on International Migration and Development,"                                    
 [19] "1. Recognize that international migration is a multidimensional reality of"                    
 [20] "major relevance for the development of countries of origin, transit and destination,"          
 [21] "and in this regard recognize that international migration is a cross-cutting"                  
 [22] "phenomenon that should be addressed in a coherent, comprehensive and balanced"                 
 [23] "manner, integrating development with due regard for social, economic and"                      
 [24] "environmental dimensions and respecting human rights;"                                         
 [25] "2. Acknowledge the important contribution made by migrants and migration"                      
 [26] "to development in countries of origin, transit and destination, as well as the complex"        
 [27] "interrelationship between migration and development;"                                          
 [28] "3. Decide to work towards an effective and inclusive agenda on"                                
 [29] "international migration that integrates development and respects human rights by"              
 [30] "improving the performance of existing institutions and frameworks, as well as"                 
 [31] "partnering more effectively with all stakeholders involved in international migration"         
 [32] "and development at the regional and global levels;"                                            
 [33] "4. Reaffirm our commitment to address the opportunities and the challenges"                    
 [34] "that international migration presents to countries of origin, transit and destination;"        
 [35] "5. Recognize the need for international cooperation to address, in a holistic"                 
 [36] "and comprehensive manner, the challenges of irregular migration to ensure safe,"               
 [37] "orderly and regular migration, with full respect for human rights;"                            
 [38] "\fA/RES/68/4 Declaration of the High-level Dialogue on International Migration and Development"
 [39] "2/4"                                                                                           
 [40] "6. Recognize the need to strengthen synergies between international"                           
 [41] "migration and development at the global, regional and national levels;"                        
 [42] "7. Recognize the efforts made by the international community in addressing"                    
 [43] "relevant aspects of international migration and development, through different"                
 [44] "initiatives, both within the United Nations system and in other processes,"                    
 [45] "particularly the Global Forum on Migration and Development and regional"                       
 [46] "processes, as well as in drawing on the expertise of the International Organization"           
 [47] "for Migration and other member agencies of the Global Migration Group;"                        
 [48] "8. Acknowledge the important contribution of migration in realizing the"                       
 [49] "Millennium Development Goals, and recognize that human mobility is a key factor"               
 [50] "for sustainable development which should be adequately considered in the"                      
 [51] "elaboration of the post-2015 development agenda;"                                              
 [52] "9. Acknowledge the important role that migrants play as partners in the"                       
 [53] "development of countries of origin, transit and destination and recognize the need to"         
 [54] "improve public perceptions of migrants and migration;"                                         
 [55] "10. Reaffirm the need to promote and protect effectively the human rights"                     
 [56] "and fundamental freedoms of all migrants, regardless of their migration status,"               
 [57] "especially those of women and children, and to address international migration"                
 [58] "through international, regional or bilateral cooperation and dialogue and through a"           
 [59] "comprehensive and balanced approach, recognizing the roles and responsibilities of"            
 [60] "countries of origin, transit and destination in promoting and protecting the human"            
 [61] "rights of all migrants, and avoiding approaches that might aggravate their"                    
 [62] "vulnerability;"                                                                                
 [63] "11. Recognize that women and girls account for almost half of all"                             
 [64] "international migrants at the global level, and the need to address the special"               
 [65] "situation and vulnerability of migrant women and girls by, inter alia, incorporating a"        
 [66] "gender perspective into policies and strengthening national laws, institutions and"            
 [67] "programmes to combat gender-based violence, including trafficking in persons and"              
 [68] "discrimination against women and girls;"                                                       
 [69] "12. Emphasize in this regard the need to establish appropriate measures for"                   
 [70] "the protection of women migrant workers in all sectors, including those involved in"           
 [71] "domestic work;"                                                                                
 [72] "13. Express the commitment to protect the human rights of migrant children,"                   
 [73] "given their vulnerability, particularly unaccompanied migrant children, and to"                
 [74] "provide for their health, education and psychosocial development, ensuring that the"           
 [75] "best interests of the child are a primary consideration in policies of integration,"           
 [76] "return and family reunification;"                                                              
 [77] "14. Emphasize the need to respect and promote international labour"                            
 [78] "standards as appropriate, and respect the rights of migrants in their workplaces;"             
 [79] "15. Note the contribution of applicable international conventions, including"                  
 [80] "the International Convention on the Protection of the Rights of All Migrant Workers"           
 [81] "and Members of Their Families,1"                                                               
 [82] "to the international system for the protection of"                                             
 [83] "migrants;"                                                                                     
 [84] "_______________"                                                                               
 [85] "1"                                                                                             
 [86] "United Nations, Treaty Series, vol. 2220, No. 39481."                                          
 [87] "\fDeclaration of the High-level Dialogue on International Migration and Development A/RES/68/4"
 [88] "3/4"                                                                                           
 [89] "16. Strongly condemn the acts, manifestations and expressions of racism,"                      
 [90] "racial discrimination, xenophobia and related intolerance against migrants and the"            
 [91] "stereotypes often applied to them, including on the basis of religion or belief, and"          
 [92] "urge States to apply and, where needed, reinforce the existing laws when"                      
 [93] "xenophobic or intolerant acts, manifestations or expressions against migrants occur,"          
 [94] "in order to eradicate impunity for those who commit those acts;"                               
 [95] "17. Reiterate our commitment to prevent and combat trafficking in persons,"                    
 [96] "protect victims of trafficking, prevent and combat migrant smuggling and protect"              
 [97] "migrants from exploitation and other abuses, stress the need to establish or upgrade,"         
 [98] "as appropriate, national and regional anti-human trafficking policies and to reinforce"        
 [99] "cooperation on prevention, the prosecution of traffickers and the protection of"               
[100] "victims of trafficking, and encourage Member States to ratify, accede to and"                  
[101] "implement relevant international instruments on preventing and combating"                      
[102] "trafficking in persons and smuggling of migrants;"                                             
[103] "18. Encourage Member States to cooperate on mobility programmes that"                          
[104] "facilitate safe, orderly and regular migration, including through labour mobility;"            
[105] "19. Recognize the particular vulnerabilities, circumstances and needs of"                      
[106] "adolescents and young migrants, as well as their potential to build social, economic"          
[107] "and cultural bridges of cooperation and understanding across societies;"                       
[108] "20. Recognize also all efforts made by Governments, all relevant bodies,"                      
[109] "agencies, funds and programmes of the United Nations system, other relevant"                   
[110] "intergovernmental, regional and subregional organizations, including the International"        
[111] "Organization for Migration and other organizations within the Global Migration"                
[112] "Group, and non-governmental stakeholders, including the private sector, in addressing"         
[113] "international migration and development for the benefit of both migrants and"                  
[114] "societies; and bearing this goal in mind, further emphasize the need to strengthen"            
[115] "partnerships among all relevant stakeholders;"                                                 
[116] "21. Stress the need to deepen the interaction between Governments and civil"                   
[117] "society to find responses to the challenges and the opportunities posed by"                    
[118] "international migration, and recognize the contribution of civil society, including"           
[119] "non-governmental organizations, to promoting the well-being of migrants and their"             
[120] "integration into societies, especially at times of extreme vulnerable conditions, and"         
[121] "the support of the international community to the efforts of such organizations;"              
[122] "22. Acknowledge the complexity of migratory flows and that international"                      
[123] "migration movements also occur within the same geographical regions, and in this"              
[124] "context call for a better understanding of migration patterns across and within regions;"      
[125] "23. Recognize the importance of coordinated efforts of the international"                      
[126] "community to assist and support migrants stranded in vulnerable situations and"                
[127] "facilitate, and cooperate on when appropriate, their voluntary return to their country"        
[128] "of origin, and call for practical and action-oriented initiatives aimed at identifying"        
[129] "and closing protection gaps;"                                                                  
[130] "24. Underline the right of migrants to return to their country of citizenship,"                
[131] "and recall that States must ensure that their returning nationals are duly received;"          
[132] "25. Recognize the need to consider the role that environmental factors may"                    
[133] "play in migration;"                                                                            
[134] "26. Recognize the necessity to consider how the migration of highly skilled"                   
[135] "persons, especially in the health, social and engineering sectors, affects the"                
[136] "development efforts of developing countries, and emphasize the need to consider"               
[137] "circular migration;"                                                                           
[138] "\fA/RES/68/4 Declaration of the High-level Dialogue on International Migration and Development"
[139] "4/4"                                                                                           
[140] "27. Recognize that remittances constitute an important source of private"                      
[141] "capital, and reaffirm the need to promote conditions for cheaper, faster and safer"            
[142] "transfers of remittances in both source and recipient countries;"                              
[143] "28. Emphasize the need for reliable statistical data on international"                         
[144] "migration, including, when possible, on the contributions of migrants to"                      
[145] "development in both countries of origin and countries of destination; this data could"         
[146] "facilitate the design of evidence-based policy- and decision-making in all relevant"           
[147] "aspects of sustainable development;"                                                           
[148] "29. Acknowledge that the Global Forum on Migration and Development has"                        
[149] "proved to be a valuable forum for holding frank and open discussions and that it has"          
[150] "helped to build trust among participating stakeholders through the exchange of"                
[151] "experiences and good practices and by virtue of its voluntary, informal State-led"             
[152] "character;"                                                                                    
[153] "30. Acknowledge that the United Nations system can benefit from the"                           
[154] "discussions and outcomes of the Global Forum on Migration and Development, in"                 
[155] "order to maximize the benefits of international migration for development;"                    
[156] "31. Call upon all relevant bodies, agencies, funds and programmes of the"                      
[157] "United Nations system, other relevant intergovernmental, regional and subregional"             
[158] "organizations, including the International Organization for Migration and other Global"        
[159] "Migration Group members, and the Special Representative of the Secretary-General"              
[160] "on International Migration and Development, within their respective mandates, to"              
[161] "strengthen their collaboration and cooperation to better and fully address the issue of"       
[162] "international migration and development, in order to adopt a coherent, comprehensive"          
[163] "and coordinated approach, and to consider migration issues in their contributions to"          
[164] "the preparatory process that will establish the post-2015 development agenda;"                 
[165] "32. Welcome the recent efforts made by the Global Migration Group to take"                     
[166] "measures to enhance its functioning and to promote coherence and coordination"                 
[167] "among its member organizations, and in this regard stress the importance of regular"           
[168] "interaction between the Group and Member States;"                                              
[169] "33. Request the Secretary-General to continue his substantive work on"                         
[170] "international migration and development and, in collaboration with the United"                 
[171] "Nations system and relevant organizations, including the International Organization"           
[172] "for Migration, to continue to assess the progress made in the field of migration and"          
[173] "development;"                                                                                  
[174] "34. Also request the Secretary-General, in the elaboration of his report on"                   
[175] "international migration and development to be submitted to the General Assembly at"            
[176] "its sixty-ninth session, to give due consideration to the results and deliberations of"        
[177] "this High-level Dialogue."                                                                     
[178] "25th plenary meeting"                                                                          
[179] "3 October 2013"                                                                                
[180] "\f"                                                                                            

The -layout option tries to mimic, with whitespace, the layout on the page. So pdftotext -layout N1343969.pdf N1343969_lo.txt returns:

layouttext <- readLines("PDFexamples/N1343969_lo.txt")
incomplete final line found on 'PDFexamples/N1343969_lo.txt'
layouttext
  [1] "                 United Nations                                                                         A/RES/68/4"               
  [2] ""                                                                                                                                 
  [3] "                                                                                                       Distr.: General"           
  [4] "                 General Assembly                                                                     21 January 2014"            
  [5] ""                                                                                                                                 
  [6] ""                                                                                                                                 
  [7] ""                                                                                                                                 
  [8] ""                                                                                                                                 
  [9] " Sixty-eighth session"                                                                                                            
 [10] " Agenda item 21 (e)"                                                                                                              
 [11] ""                                                                                                                                 
 [12] ""                                                                                                                                 
 [13] "            Resolution adopted by the General Assembly on 3 October 2013"                                                         
 [14] "                                [without reference to a Main Committee (A/68/L.5)]"                                               
 [15] ""                                                                                                                                 
 [16] ""                                                                                                                                 
 [17] "              68/4. Declaration of the High-level Dialogue on International"                                                      
 [18] "                    Migration and Development"                                                                                    
 [19] ""                                                                                                                                 
 [20] "                    The General Assembly"                                                                                         
 [21] "                    Adopts the following declaration:"                                                                            
 [22] ""                                                                                                                                 
 [23] "              Declaration of the High-level Dialogue on International Migration"                                                  
 [24] "              and Development"                                                                                                    
 [25] "                    We, representatives of States and Governments, gathered at United Nations"                                    
 [26] "              Headquarters in New York on 3 and 4 October 2013 on the occasion of the High-"                                      
 [27] "              level Dialogue on International Migration and Development,"                                                         
 [28] "                   1.   Recognize that international migration is a multidimensional reality of"                                  
 [29] "              major relevance for the development of countries of origin, transit and destination,"                               
 [30] "              and in this regard recognize that international migration is a cross-cutting"                                       
 [31] "              phenomenon that should be addressed in a coherent, comprehensive and balanced"                                      
 [32] "              manner, integrating development with due regard for social, economic and"                                           
 [33] "              environmental dimensions and respecting human rights;"                                                              
 [34] "                    2.    Acknowledge the important contribution made by migrants and migration"                                  
 [35] "              to development in countries of origin, transit and destination, as well as the complex"                             
 [36] "              interrelationship between migration and development;"                                                               
 [37] "                    3.   Decide to work towards an effective and inclusive agenda on"                                             
 [38] "              international migration that integrates development and respects human rights by"                                   
 [39] "              improving the performance of existing institutions and frameworks, as well as"                                      
 [40] "              partnering more effectively with all stakeholders involved in international migration"                              
 [41] "              and development at the regional and global levels;"                                                                 
 [42] "                    4.    Reaffirm our commitment to address the opportunities and the challenges"                                
 [43] "              that international migration presents to countries of origin, transit and destination;"                             
 [44] "                   5.    Recognize the need for international cooperation to address, in a holistic"                              
 [45] "              and comprehensive manner, the challenges of irregular migration to ensure safe,"                                    
 [46] "              orderly and regular migration, with full respect for human rights;"                                                 
 [47] ""                                                                                                                                 
 [48] ""                                                                                                                                 
 [49] "13-43969"                                                                                                                         
 [50] "*1343969*                                                                            Please recycle"                              
 [51] "\fA/RES/68/4                                    Declaration of the High-level Dialogue on International Migration and Development"
 [52] ""                                                                                                                                 
 [53] ""                                                                                                                                 
 [54] "                  6.    Recognize the need to strengthen synergies between international"                                         
 [55] "             migration and development at the global, regional and national levels;"                                              
 [56] "                   7.    Recognize the efforts made by the international community in addressing"                                 
 [57] "             relevant aspects of international migration and development, through different"                                      
 [58] "             initiatives, both within the United Nations system and in other processes,"                                          
 [59] "             particularly the Global Forum on Migration and Development and regional"                                             
 [60] "             processes, as well as in drawing on the expertise of the International Organization"                                 
 [61] "             for Migration and other member agencies of the Global Migration Group;"                                              
 [62] "                  8.    Acknowledge the important contribution of migration in realizing the"                                     
 [63] "             Millennium Development Goals, and recognize that human mobility is a key factor"                                     
 [64] "             for sustainable development which should be adequately considered in the"                                            
 [65] "             elaboration of the post-2015 development agenda;"                                                                    
 [66] "                  9.   Acknowledge the important role that migrants play as partners in the"                                      
 [67] "             development of countries of origin, transit and destination and recognize the need to"                               
 [68] "             improve public perceptions of migrants and migration;"                                                               
 [69] "                   10. Reaffirm the need to promote and protect effectively the human rights"                                     
 [70] "             and fundamental freedoms of all migrants, regardless of their migration status,"                                     
 [71] "             especially those of women and children, and to address international migration"                                      
 [72] "             through international, regional or bilateral cooperation and dialogue and through a"                                 
 [73] "             comprehensive and balanced approach, recognizing the roles and responsibilities of"                                  
 [74] "             countries of origin, transit and destination in promoting and protecting the human"                                  
 [75] "             rights of all migrants, and avoiding approaches that might aggravate their"                                          
 [76] "             vulnerability;"                                                                                                      
 [77] "                   11. Recognize that women and girls account for almost half of all"                                             
 [78] "             international migrants at the global level, and the need to address the special"                                     
 [79] "             situation and vulnerability of migrant women and girls by, inter alia, incorporating a"                              
 [80] "             gender perspective into policies and strengthening national laws, institutions and"                                  
 [81] "             programmes to combat gender-based violence, including trafficking in persons and"                                    
 [82] "             discrimination against women and girls;"                                                                             
 [83] "                   12. Emphasize in this regard the need to establish appropriate measures for"                                   
 [84] "             the protection of women migrant workers in all sectors, including those involved in"                                 
 [85] "             domestic work;"                                                                                                      
 [86] "                   13. Express the commitment to protect the human rights of migrant children,"                                   
 [87] "             given their vulnerability, particularly unaccompanied migrant children, and to"                                      
 [88] "             provide for their health, education and psychosocial development, ensuring that the"                                 
 [89] "             best interests of the child are a primary consideration in policies of integration,"                                 
 [90] "             return and family reunification;"                                                                                    
 [91] "                  14. Emphasize the need to respect and promote international labour"                                             
 [92] "             standards as appropriate, and respect the rights of migrants in their workplaces;"                                   
 [93] "                   15. Note the contribution of applicable international conventions, including"                                  
 [94] "             the International Convention on the Protection of the Rights of All Migrant Workers"                                 
 [95] "             and Members of Their Families, 1 to the international system for the protection of"                                  
 [96] "             migrants;"                                                                                                           
 [97] ""                                                                                                                                 
 [98] ""                                                                                                                                 
 [99] ""                                                                                                                                 
[100] ""                                                                                                                                 
[101] "             _______________"                                                                                                     
[102] "             1"                                                                                                                   
[103] "                 United Nations, Treaty Series, vol. 2220, No. 39481."                                                            
[104] ""                                                                                                                                 
[105] "2/4"                                                                                                                              
[106] "\fDeclaration of the High-level Dialogue on International Migration and Development                         A/RES/68/4"           
[107] ""                                                                                                                                 
[108] ""                                                                                                                                 
[109] "                     16. Strongly condemn the acts, manifestations and expressions of racism,"                                    
[110] "               racial discrimination, xenophobia and related intolerance against migrants and the"                                
[111] "               stereotypes often applied to them, including on the basis of religion or belief, and"                              
[112] "               urge States to apply and, where needed, reinforce the existing laws when"                                          
[113] "               xenophobic or intolerant acts, manifestations or expressions against migrants occur,"                              
[114] "               in order to eradicate impunity for those who commit those acts;"                                                   
[115] "                     17. Reiterate our commitment to prevent and combat trafficking in persons,"                                  
[116] "               protect victims of trafficking, prevent and combat migrant smuggling and protect"                                  
[117] "               migrants from exploitation and other abuses, stress the need to establish or upgrade,"                             
[118] "               as appropriate, national and regional anti-human trafficking policies and to reinforce"                            
[119] "               cooperation on prevention, the prosecution of traffickers and the protection of"                                   
[120] "               victims of trafficking, and encourage Member States to ratify, accede to and"                                      
[121] "               implement relevant international instruments on preventing and combating"                                          
[122] "               trafficking in persons and smuggling of migrants;"                                                                 
[123] "                     18. Encourage Member States to cooperate on mobility programmes that"                                        
[124] "               facilitate safe, orderly and regular migration, including through labour mobility;"                                
[125] "                    19. Recognize the particular vulnerabilities, circumstances and needs of"                                     
[126] "               adolescents and young migrants, as well as their potential to build social, economic"                              
[127] "               and cultural bridges of cooperation and understanding across societies;"                                           
[128] "                     20. Recognize also all efforts made by Governments, all relevant bodies,"                                    
[129] "               agencies, funds and programmes of the United Nations system, other relevant"                                       
[130] "               intergovernmental, regional and subregional organizations, including the International"                            
[131] "               Organization for Migration and other organizations within the Global Migration"                                    
[132] "               Group, and non-governmental stakeholders, including the private sector, in addressing"                             
[133] "               international migration and development for the benefit of both migrants and"                                      
[134] "               societies; and bearing this goal in mind, further emphasize the need to strengthen"                                
[135] "               partnerships among all relevant stakeholders;"                                                                     
[136] "                     21. Stress the need to deepen the interaction between Governments and civil"                                 
[137] "               society to find responses to the challenges and the opportunities posed by"                                        
[138] "               international migration, and recognize the contribution of civil society, including"                               
[139] "               non-governmental organizations, to promoting the well-being of migrants and their"                                 
[140] "               integration into societies, especially at times of extreme vulnerable conditions, and"                             
[141] "               the support of the international community to the efforts of such organizations;"                                  
[142] "                    22. Acknowledge the complexity of migratory flows and that international"                                     
[143] "               migration movements also occur within the same geographical regions, and in this"                                  
[144] "               context call for a better understanding of migration patterns across and within regions;"                          
[145] "                     23. Recognize the importance of coordinated efforts of the international"                                    
[146] "               community to assist and support migrants stranded in vulnerable situations and"                                    
[147] "               facilitate, and cooperate on when appropriate, their voluntary return to their country"                            
[148] "               of origin, and call for practical and action-oriented initiatives aimed at identifying"                            
[149] "               and closing protection gaps;"                                                                                      
[150] "                    24. Underline the right of migrants to return to their country of citizenship,"                               
[151] "               and recall that States must ensure that their returning nationals are duly received;"                              
[152] "                     25. Recognize the need to consider the role that environmental factors may"                                  
[153] "               play in migration;"                                                                                                
[154] "                     26. Recognize the necessity to consider how the migration of highly skilled"                                 
[155] "               persons, especially in the health, social and engineering sectors, affects the"                                    
[156] "               development efforts of developing countries, and emphasize the need to consider"                                   
[157] "               circular migration;"                                                                                               
[158] ""                                                                                                                                 
[159] "                                                                                                                 3/4"             
[160] "\fA/RES/68/4                            Declaration of the High-level Dialogue on International Migration and Development"        
[161] ""                                                                                                                                 
[162] ""                                                                                                                                 
[163] "                   27. Recognize that remittances constitute an important source of private"                                      
[164] "             capital, and reaffirm the need to promote conditions for cheaper, faster and safer"                                  
[165] "             transfers of remittances in both source and recipient countries;"                                                    
[166] "                   28. Emphasize the need for reliable statistical data on international"                                         
[167] "             migration, including, when possible, on the contributions of migrants to"                                            
[168] "             development in both countries of origin and countries of destination; this data could"                               
[169] "             facilitate the design of evidence-based policy- and decision-making in all relevant"                                 
[170] "             aspects of sustainable development;"                                                                                 
[171] "                  29. Acknowledge that the Global Forum on Migration and Development has"                                         
[172] "             proved to be a valuable forum for holding frank and open discussions and that it has"                                
[173] "             helped to build trust among participating stakeholders through the exchange of"                                      
[174] "             experiences and good practices and by virtue of its voluntary, informal State-led"                                   
[175] "             character;"                                                                                                          
[176] "                  30. Acknowledge that the United Nations system can benefit from the"                                            
[177] "             discussions and outcomes of the Global Forum on Migration and Development, in"                                       
[178] "             order to maximize the benefits of international migration for development;"                                          
[179] "                   31. Call upon all relevant bodies, agencies, funds and programmes of the"                                      
[180] "             United Nations system, other relevant intergovernmental, regional and subregional"                                   
[181] "             organizations, including the International Organization for Migration and other Global"                              
[182] "             Migration Group members, and the Special Representative of the Secretary-General"                                    
[183] "             on International Migration and Development, within their respective mandates, to"                                    
[184] "             strengthen their collaboration and cooperation to better and fully address the issue of"                             
[185] "             international migration and development, in order to adopt a coherent, comprehensive"                                
[186] "             and coordinated approach, and to consider migration issues in their contributions to"                                
[187] "             the preparatory process that will establish the post-2015 development agenda;"                                       
[188] "                   32. Welcome the recent efforts made by the Global Migration Group to take"                                     
[189] "             measures to enhance its functioning and to promote coherence and coordination"                                       
[190] "             among its member organizations, and in this regard stress the importance of regular"                                 
[191] "             interaction between the Group and Member States;"                                                                    
[192] "                   33. Request the Secretary-General to continue his substantive work on"                                         
[193] "             international migration and development and, in collaboration with the United"                                       
[194] "             Nations system and relevant organizations, including the International Organization"                                 
[195] "             for Migration, to continue to assess the progress made in the field of migration and"                                
[196] "             development;"                                                                                                        
[197] "                   34. Also request the Secretary-General, in the elaboration of his report on"                                   
[198] "             international migration and development to be submitted to the General Assembly at"                                  
[199] "             its sixty-ninth session, to give due consideration to the results and deliberations of"                              
[200] "             this High-level Dialogue."                                                                                           
[201] ""                                                                                                                                 
[202] "                                                                                25th plenary meeting"                             
[203] "                                                                                     3 October 2013"                              
[204] ""                                                                                                                                 
[205] ""                                                                                                                                 
[206] ""                                                                                                                                 
[207] ""                                                                                                                                 
[208] "4/4"                                                                                                                              
[209] "\f"                                                                                                                               

You can add the -f and -l flags to any of the above to specify a page range. So, to get the “straight” text for just pages 2 and 3, you use pdftotext -f 2 -l 3 N1343969.pdf N1343969_pp23.txt:

pages2and3 <- readLines("PDFexamples/N1343969_pp23.txt")
incomplete final line found on 'PDFexamples/N1343969_pp23.txt'
pages2and3
  [1] "A/RES/68/4"                                                                              
  [2] ""                                                                                        
  [3] "Declaration of the High-level Dialogue on International Migration and Development"       
  [4] ""                                                                                        
  [5] "6."                                                                                      
  [6] "Recognize the need to strengthen synergies between international"                        
  [7] "migration and development at the global, regional and national levels;"                  
  [8] "7."                                                                                      
  [9] "Recognize the efforts made by the international community in addressing"                 
 [10] "relevant aspects of international migration and development, through different"          
 [11] "initiatives, both within the United Nations system and in other processes,"              
 [12] "particularly the Global Forum on Migration and Development and regional"                 
 [13] "processes, as well as in drawing on the expertise of the International Organization"     
 [14] "for Migration and other member agencies of the Global Migration Group;"                  
 [15] "8."                                                                                      
 [16] "Acknowledge the important contribution of migration in realizing the"                    
 [17] "Millennium Development Goals, and recognize that human mobility is a key factor"         
 [18] "for sustainable development which should be adequately considered in the"                
 [19] "elaboration of the post-2015 development agenda;"                                        
 [20] "9."                                                                                      
 [21] "Acknowledge the important role that migrants play as partners in the"                    
 [22] "development of countries of origin, transit and destination and recognize the need to"   
 [23] "improve public perceptions of migrants and migration;"                                   
 [24] "10. Reaffirm the need to promote and protect effectively the human rights"               
 [25] "and fundamental freedoms of all migrants, regardless of their migration status,"         
 [26] "especially those of women and children, and to address international migration"          
 [27] "through international, regional or bilateral cooperation and dialogue and through a"     
 [28] "comprehensive and balanced approach, recognizing the roles and responsibilities of"      
 [29] "countries of origin, transit and destination in promoting and protecting the human"      
 [30] "rights of all migrants, and avoiding approaches that might aggravate their"              
 [31] "vulnerability;"                                                                          
 [32] "11. Recognize that women and girls account for almost half of all"                       
 [33] "international migrants at the global level, and the need to address the special"         
 [34] "situation and vulnerability of migrant women and girls by, inter alia, incorporating a"  
 [35] "gender perspective into policies and strengthening national laws, institutions and"      
 [36] "programmes to combat gender-based violence, including trafficking in persons and"        
 [37] "discrimination against women and girls;"                                                 
 [38] "12. Emphasize in this regard the need to establish appropriate measures for"             
 [39] "the protection of women migrant workers in all sectors, including those involved in"     
 [40] "domestic work;"                                                                          
 [41] "13. Express the commitment to protect the human rights of migrant children,"             
 [42] "given their vulnerability, particularly unaccompanied migrant children, and to"          
 [43] "provide for their health, education and psychosocial development, ensuring that the"     
 [44] "best interests of the child are a primary consideration in policies of integration,"     
 [45] "return and family reunification;"                                                        
 [46] "14. Emphasize the need to respect and promote international labour"                      
 [47] "standards as appropriate, and respect the rights of migrants in their workplaces;"       
 [48] "15. Note the contribution of applicable international conventions, including"            
 [49] "the International Convention on the Protection of the Rights of All Migrant Workers"     
 [50] "and Members of Their Families, 1 to the international system for the protection of"      
 [51] "migrants;"                                                                               
 [52] ""                                                                                        
 [53] "_______________"                                                                         
 [54] "1"                                                                                       
 [55] ""                                                                                        
 [56] "2/4"                                                                                     
 [57] ""                                                                                        
 [58] "United Nations, Treaty Series, vol. 2220, No. 39481."                                    
 [59] ""                                                                                        
 [60] "\fDeclaration of the High-level Dialogue on International Migration and Development"     
 [61] ""                                                                                        
 [62] "A/RES/68/4"                                                                              
 [63] ""                                                                                        
 [64] "16. Strongly condemn the acts, manifestations and expressions of racism,"                
 [65] "racial discrimination, xenophobia and related intolerance against migrants and the"      
 [66] "stereotypes often applied to them, including on the basis of religion or belief, and"    
 [67] "urge States to apply and, where needed, reinforce the existing laws when"                
 [68] "xenophobic or intolerant acts, manifestations or expressions against migrants occur,"    
 [69] "in order to eradicate impunity for those who commit those acts;"                         
 [70] "17. Reiterate our commitment to prevent and combat trafficking in persons,"              
 [71] "protect victims of trafficking, prevent and combat migrant smuggling and protect"        
 [72] "migrants from exploitation and other abuses, stress the need to establish or upgrade,"   
 [73] "as appropriate, national and regional anti-human trafficking policies and to reinforce"  
 [74] "cooperation on prevention, the prosecution of traffickers and the protection of"         
 [75] "victims of trafficking, and encourage Member States to ratify, accede to and"            
 [76] "implement relevant international instruments on preventing and combating"                
 [77] "trafficking in persons and smuggling of migrants;"                                       
 [78] "18. Encourage Member States to cooperate on mobility programmes that"                    
 [79] "facilitate safe, orderly and regular migration, including through labour mobility;"      
 [80] "19. Recognize the particular vulnerabilities, circumstances and needs of"                
 [81] "adolescents and young migrants, as well as their potential to build social, economic"    
 [82] "and cultural bridges of cooperation and understanding across societies;"                 
 [83] "20. Recognize also all efforts made by Governments, all relevant bodies,"                
 [84] "agencies, funds and programmes of the United Nations system, other relevant"             
 [85] "intergovernmental, regional and subregional organizations, including the International"  
 [86] "Organization for Migration and other organizations within the Global Migration"          
 [87] "Group, and non-governmental stakeholders, including the private sector, in addressing"   
 [88] "international migration and development for the benefit of both migrants and"            
 [89] "societies; and bearing this goal in mind, further emphasize the need to strengthen"      
 [90] "partnerships among all relevant stakeholders;"                                           
 [91] "21. Stress the need to deepen the interaction between Governments and civil"             
 [92] "society to find responses to the challenges and the opportunities posed by"              
 [93] "international migration, and recognize the contribution of civil society, including"     
 [94] "non-governmental organizations, to promoting the well-being of migrants and their"       
 [95] "integration into societies, especially at times of extreme vulnerable conditions, and"   
 [96] "the support of the international community to the efforts of such organizations;"        
 [97] "22. Acknowledge the complexity of migratory flows and that international"                
 [98] "migration movements also occur within the same geographical regions, and in this"        
 [99] "context call for a better understanding of migration patterns across and within regions;"
[100] "23. Recognize the importance of coordinated efforts of the international"                
[101] "community to assist and support migrants stranded in vulnerable situations and"          
[102] "facilitate, and cooperate on when appropriate, their voluntary return to their country"  
[103] "of origin, and call for practical and action-oriented initiatives aimed at identifying"  
[104] "and closing protection gaps;"                                                            
[105] "24. Underline the right of migrants to return to their country of citizenship,"          
[106] "and recall that States must ensure that their returning nationals are duly received;"    
[107] "25. Recognize the need to consider the role that environmental factors may"              
[108] "play in migration;"                                                                      
[109] "26. Recognize the necessity to consider how the migration of highly skilled"             
[110] "persons, especially in the health, social and engineering sectors, affects the"          
[111] "development efforts of developing countries, and emphasize the need to consider"         
[112] "circular migration;"                                                                     
[113] "3/4"                                                                                     
[114] ""                                                                                        
[115] "\f"                                                                                      

If you want just a section of a page (or all pages), you can “crop” by setting the starting location “x” and “y”, in XX from the upper left of the page, and defining a box of width “W” and height “H”. So, to get page 2 with the margins, header, and footer (page number) removed, you could use pdftotext -x 72 -y 72 -W 468 -H 648 -f 2 -l 2 N1343969.pdf N1343969_crop.txt:

croppedtext <- readLines("PDFexamples/N1343969_crop.txt")
incomplete final line found on 'PDFexamples/N1343969_crop.txt'
croppedtext
 [1] "6."                                                                                    
 [2] "Recognize the need to strengthen synergies between international"                      
 [3] "migration and development at the global, regional and national levels;"                
 [4] "7."                                                                                    
 [5] "Recognize the efforts made by the international community in addressing"               
 [6] "relevant aspects of international migration and development, through different"        
 [7] "initiatives, both within the United Nations system and in other processes,"            
 [8] "particularly the Global Forum on Migration and Development and regional"               
 [9] "processes, as well as in drawing on the expertise of the International Organization"   
[10] "for Migration and other member agencies of the Global Migration Group;"                
[11] "8."                                                                                    
[12] "Acknowledge the important contribution of migration in realizing the"                  
[13] "Millennium Development Goals, and recognize that human mobility is a key factor"       
[14] "for sustainable development which should be adequately considered in the"              
[15] "elaboration of the post-2015 development agenda;"                                      
[16] "9."                                                                                    
[17] "Acknowledge the important role that migrants play as partners in the"                  
[18] "development of countries of origin, transit and destination and recognize the need to" 
[19] "improve public perceptions of migrants and migration;"                                 
[20] "10. Reaffirm the need to promote and protect effectively the human rights"             
[21] "and fundamental freedoms of all migrants, regardless of their migration status,"       
[22] "especially those of women and children, and to address international migration"        
[23] "through international, regional or bilateral cooperation and dialogue and through a"   
[24] "comprehensive and balanced approach, recognizing the roles and responsibilities of"    
[25] "countries of origin, transit and destination in promoting and protecting the human"    
[26] "rights of all migrants, and avoiding approaches that might aggravate their"            
[27] "vulnerability;"                                                                        
[28] "11. Recognize that women and girls account for almost half of all"                     
[29] "international migrants at the global level, and the need to address the special"       
[30] "situation and vulnerability of migrant women and girls by, inter alia, incorporating a"
[31] "gender perspective into policies and strengthening national laws, institutions and"    
[32] "programmes to combat gender-based violence, including trafficking in persons and"      
[33] "discrimination against women and girls;"                                               
[34] "12. Emphasize in this regard the need to establish appropriate measures for"           
[35] "the protection of women migrant workers in all sectors, including those involved in"   
[36] "domestic work;"                                                                        
[37] "13. Express the commitment to protect the human rights of migrant children,"           
[38] "given their vulnerability, particularly unaccompanied migrant children, and to"        
[39] "provide for their health, education and psychosocial development, ensuring that the"   
[40] "best interests of the child are a primary consideration in policies of integration,"   
[41] "return and family reunification;"                                                      
[42] "14. Emphasize the need to respect and promote international labour"                    
[43] "standards as appropriate, and respect the rights of migrants in their workplaces;"     
[44] "15. Note the contribution of applicable international conventions, including"          
[45] "the International Convention on the Protection of the Rights of All Migrant Workers"   
[46] "and Members of Their Families, 1 to the international system for the protection of"    
[47] "migrants;"                                                                             
[48] ""                                                                                      
[49] "_______________"                                                                       
[50] "1"                                                                                     
[51] ""                                                                                      
[52] "United Nations, Treaty Series, vol. 2220, No. 39481."                                  
[53] ""                                                                                      
[54] "\f"                                                                                    

A messier example

Consider this page from the archived French National Assembly, which has been OCR’d.

A messier example

cd PDFexamples
pdftotext FranceNA1994-10-28-1.046-page13.pdf France_straight.txt
cd ..
FranceStraight <- readLines("PDFexamples/France_straight.txt")
incomplete final line found on 'PDFexamples/France_straight.txt'
FranceStraight
  [1] "ASSEMBLÉE NATIONALE - ?d SÉANCE DU 28 OCTOBRE 1994"                                                                                                                                                              
  [2] ""                                                                                                                                                                                                                
  [3] "d'encadrement. Il reste que le soin que nous mettons"                                                                                                                                                            
  [4] "rians l'emploi que nous proposons à ces femmes et à ces"                                                                                                                                                         
  [5] "hommes doit être renforcé."                                                                                                                                                                                      
  [6] "Je vous ai déjà dit à de multiples reprises eZ que je ressentais à propos des règles d'affectation des enseignants :"                                                                                            
  [7] "un jeu dont la règle consisterait à remplir des cases avec"                                                                                                                                                      
  [8] "des pions sans jamais se soutier des émotions, des"                                                                                                                                                              
  [9] "attentes, des difficultés que ces hommes et ces femmes"                                                                                                                                                          
 [10] "rencontrent serait, me sunble't-il, un choix malheureux."                                                                                                                                                        
 [11] "Et je souhaite ;rompre avec ces habitudes - en tout cas"                                                                                                                                                         
 [12] "avec ce qu'il en reste. Je veux dire par là que l'éducation"                                                                                                                                                     
 [13] "ignore c c que la plus petite des Plsa connaît par coeur :"                                                                                                                                                      
 [14] "le profil personnel, l'adéquation d'un individu à un poste,"                                                                                                                                                     
 [15] "la gestion prévisionnelle des effectifs, bref tous les rudiments de ce qu'on appelle la gestion des ressources"                                                                                                  
 [16] "humaines."                                                                                                                                                                                                       
 [17] "M. Bernard de Froment, rapporteur spécial C 'est vrai !"                                                                                                                                                         
 [18] "M. le Ministre de l'éducation nationale. Cette ignorance me parait être la source de bien des ' onctionnements et de bien des gâchis. Je crois que, ans toute vie"                                               
 [19] "professionnelle, lorsqu'un homme ou une femme n'a pas 1"                                                                                                                                                         
 [20] "la conscience d'être la personne qu'il faut à l'endroit qu'il"                                                                                                                                                   
 [21] "faut, il se décourage et n'obtient pas les résultats qu'on"                                                                                                                                                      
 [22] "pourrait attendre de lui . Dans le cadre particulier de"                                                                                                                                                         
 [23] "l'école, cela risque en outre de faire tache d'huile parce"                                                                                                                                                      
 [24] "ue c'est l'ambiance de tout 'an étaldissttnent qui risque"                                                                                                                                                       
 [25] "'en souffrir. C'est pourquoi la décision que j 'ai prise de"                                                                                                                                                     
 [26] "cesser de nommer des e nseign a rts-débutants sur des"                                                                                                                                                           
 [27] "postes articulièrement . difficiles (Applaudissements sur les"                                                                                                                                                   
 [28] "pana groupe de l'Union pour la démocratie francise et"                                                                                                                                                           
 [29] "du Centre et du groupe du Rassemblement pour la"                                                                                                                                                                 
 [30] "République)"                                                                                                                                                                                                     
 [31] "M. Michel Péricar d, st résident de la commission des"                                                                                                                                                           
 [32] "entres culturelles. C'est plus intelligent !"                                                                                                                                                                    
 [33] ""                                                                                                                                                                                                                
 [34] "j"                                                                                                                                                                                                               
 [35] ""                                                                                                                                                                                                                
 [36] "M. le ministre de l'éducation nationale . ... qui sera en"                                                                                                                                                       
 [37] ""                                                                                                                                                                                                                
 [38] "vigueur à la rentrée 1995 . Cette décision est, à mes yeux,"                                                                                                                                                     
 [39] "essentielle . Sauf, naturellement, si l'enseignant est volontaire,..."                                                                                                                                           
 [40] "M.. Michel Périmai, président de la commission des"                                                                                                                                                              
 [41] "affaires culturelles. Et encore !"                                                                                                                                                                               
 [42] "M. le ministre de l'éducation nationale. ... ce qui est"                                                                                                                                                         
 [43] "respectable, voire souhaitable, et ce que, alors, je soutiendrai."                                                                                                                                               
 [44] "L'enjeu est de trouver la meilleure adéquation possible"                                                                                                                                                         
 [45] "d'une personne à un emploi, de tenter de concilier l'utilité sociale et l'épanouissement individuel. L'école a tout"                                                                                             
 [46] "d y gagner."                                                                                                                                                                                                     
 [47] "Il faut faire aussi confiance au terrain en apportant les"                                                                                                                                                       
 [48] "moyens d'une réponse locale, de proximité, aux demandes"                                                                                                                                                         
 [49] "des élèves. Nous savons tous ou'un a tendance à demander trop à l'école. Ors la rend responsable de situations"                                                                                                  
 [50] ". qu'elle subir, «imam le chômage."                                                                                                                                                                              
 [51] "Les responsables des dtablisserents ont à connaître de"                                                                                                                                                          
 [52] "situations de crise financière de familles. Pour donner aux"                                                                                                                                                     
 [53] "acteurs du terrain les moyens d'intervenir rapidement et"                                                                                                                                                        
 [54] "de façon souple, nous avons décidé la création d 'un"                                                                                                                                                            
 [55] "Fonds social collégien, qui cera mis en place au"                                                                                                                                                                
 [56] "janvier 1995, et doté, pour la première année, de 100 millions de flancs, dont je souhaite que l'utilisation soit la"                                                                                            
 [57] "plus 'souple possible, afin de faciliter l'intervention des"                                                                                                                                                     
 [58] "chefs d'établissement et de ne .pas compliquer leur acheC'est la manière la plus efficace d'intervenir face à des"                                                                                               
 [59] "risques de maiginalisation, dorlt les effets sont toujours"                                                                                                                                                      
 [60] "très rapid"                                                                                                                                                                                                      
 [61] "es."                                                                                                                                                                                                             
 [62] ", C'est également dans, un souci d'efficacité et d'équité"                                                                                                                                                       
 [63] "ue le Gouvernement a prévu l'allocation exceptionnelle"                                                                                                                                                          
 [64] "r à l'article 23, alinéa 5, de la loi relative à la"                                                                                                                                                             
 [65] ""                                                                                                                                                                                                                
 [66] "G231"                                                                                                                                                                                                            
 [67] ""                                                                                                                                                                                                                
 [68] "famille Cette allocation est destinée à compenser intégralement toutes les pertes financières que pourraient"                                                                                                    
 [69] "occasionner le transfert de la gestion des bourses des collèges aux suisses d'allocations familiale et leur changement de forme. Son paiement interviendra dans le courant du mois de janvier 1995."             
 [70] "Je noterai également l'accroissement de 20 millions de"                                                                                                                                                          
 [71] "francs des ts de bourses des lycées, et surtout rang"                                                                                                                                                            
 [72] "nmitarion, à laquelle je m'étais engagé, de 32 millions de"                                                                                                                                                      
 [73] "francs, c'est-à-dire de 12 p . 100 en une seule année, des"                                                                                                                                                      
 [74] "moyens consacrés aux stages en entreprise dis élèves '3es"                                                                                                                                                       
 [75] "lycées et des lycées professionnels . Les frais exposés par les"                                                                                                                                                 
 [76] "fèves â l'occasion de ces stages seront mieux couverts."                                                                                                                                                         
 [77] "Faire confiance au terrain, c 'est aussi lui donner les"                                                                                                                                                         
 [78] "avens de remplir Ies miss ions qui lui sont confiées."                                                                                                                                                           
 [79] "Globalement, les crédits de fonctionnement et d'intervention de l'éducation nationale progressent de plus de"                                                                                                    
 [80] "270 millions de francs. En particulier, afin de tenir"                                                                                                                                                           
 [81] "compte de l'augmentation prévisible du nombre de candidats aux examens et aux concours, et notamment de la"                                                                                                      
 [82] "mis` en place du concours spécifique de recrutement des"                                                                                                                                                         
 [83] "maîtres auxiliaires, les crédits correspondants sont abondés de 92,5 millions de francs."                                                                                                                        
 [84] "Cette année, dans les crédits de fonctionnement,"                                                                                                                                                                
 [85] "l'arme a été mis sur les conditions d'exercice des métiers"                                                                                                                                                      
 [86] "au sein de l'éducation nationale, avec deux dispositions,"                                                                                                                                                       
 [87] "dont je souhaite que vous mesuriez l'ampleur."                                                                                                                                                                   
 [88] "Première disposition : une augmentation des frais de"                                                                                                                                                            
 [89] "déplacement de 22 millions de francs, c'est-à-dire de près"                                                                                                                                                      
 [90] "de 10 p. 100 de ce qui était engagé - avec l'obligation"                                                                                                                                                         
 [91] "pour Ies rectorats de gérer désormais ces frais de déplacement sur une ligne particulière, de manière qu'ils -ne"                                                                                                
 [92] "puissent plus être utilisés pour autre chose, comme le"                                                                                                                                                          
 [93] "paiement des dépenses de fonctionnement courant."                                                                                                                                                                
 [94] "M. Bernard de Froment rapporteur spécial Très bien !"                                                                                                                                                            
 [95] "M . le ministre de l'éducation nationale . Seconde disposition : l'accroissement des crédits de formation continue de 10 p. 100 en une seule année. Cette augmentation de crédits est naturellement le reflet de"
 [96] "l'attente très grande qui est la nôtre en faveur de la formation continue des enseignants."                                                                                                                      
 [97] "Ces augmentations de crédits s'accompagnent d'un"                                                                                                                                                                
 [98] "changement de politique : une individualisation de la"                                                                                                                                                           
 [99] "ligne et, pour les MAFPEN, des plans académiques qui"                                                                                                                                                            
[100] "doivent s intégrer dans les orientations définies au niveau"                                                                                                                                                     
[101] "national."                                                                                                                                                                                                       
[102] "La nouvelle organisation supposa de nouvelles"                                                                                                                                                                   
[103] "méthodes de gestion, qui se fondent sur le principe de"                                                                                                                                                          
[104] "responsabilité . C'est particuli'eremenr vrai pour l'administration centrale, où des mesures de simplification et de"                                                                                            
[105] "déconcentration sont prises. C'est pourouoi j'ai mis en"                                                                                                                                                         
[106] "place 37 unités de suivi différentes, chargées d'animer et"                                                                                                                                                      
[107] "de mettre en oeuvre de manière individualisée les mesures"                                                                                                                                                       
[108] "du Nouveau contrat pour l'édile."                                                                                                                                                                                
[109] "A tes unités de suivi, les partenaires de l'école sont"                                                                                                                                                          
[110] "associés. Chaque responsable de chaque unité a passé un"                                                                                                                                                         
[111] "contrat avec moi, établi le calendrier, à charge pour . lui"                                                                                                                                                     
[112] "d'en respecter les termes . La même r e vaut pour les"                                                                                                                                                           
[113] "é9uipes éducatives dans le cadre de 1 expérimentation."                                                                                                                                                          
[114] "C est à cette-condition que les mesures du Nouveau"                                                                                                                                                              
[115] "tdntrat pour l'école, qui supposent des modifications de"                                                                                                                                                        
[116] "textes réglementaires, aboutiront à des réformes concrètes"                                                                                                                                                      
[117] "et effectives ."                                                                                                                                                                                                 
[118] "Telles sont, mesdames, messieurs les députés, les"                                                                                                                                                               
[119] "des lignes du projet de loi de finances pour 1995."                                                                                                                                                              
[120] "ai voulu que ce projet de budget soit la traduction fidèle"                                                                                                                                                      
[121] "de la politique éducative que nous menons en faveur de"                                                                                                                                                          
[122] ""                                                                                                                                                                                                                
[123] "\f"                                                                                                                                                                                                              

OCR errors aside, that did better than I expected. Note that this example has hyphenated words and pdftotext sews them together, e.g. “rudiments” on line 15 and “ignorance” on line 18.

It looks like it got the columns right, but it can often be hard to detect whether this is correct across a whole document or set of documents.

If we want to be sure we pick out a column at a time, we can use the cropping option. With a little trial and error, this seems to come close:

cd PDFexamples
pdftotext -x 30 -y 30 -W 240 -H 740 FranceNA1994-10-28-1.046-page13.pdf France_crop.txt
cd ..
FranceCropCol1 <- readLines("PDFexamples/France_crop.txt")
incomplete final line found on 'PDFexamples/France_crop.txt'
FranceCropCol1
 [1] "d'encadrement. Il reste que le soin que nous mettons"                                                                                                             
 [2] "rians l'emploi que nous proposons à ces femmes et à ces"                                                                                                          
 [3] "hommes doit être renforcé."                                                                                                                                       
 [4] "Je vous ai déjà dit à de multiples reprises eZ que je ressentais à propos des règles d'affectation des enseignants :"                                             
 [5] "un jeu dont la règle consisterait à remplir des cases avec"                                                                                                       
 [6] "des pions sans jamais se soutier des émotions, des"                                                                                                               
 [7] "attentes, des difficultés que ces hommes et ces femmes"                                                                                                           
 [8] "rencontrent serait, me sunble't-il, un choix malheureux."                                                                                                         
 [9] "Et je souhaite ;rompre avec ces habitudes - en tout cas"                                                                                                          
[10] "avec ce qu'il en reste. Je veux dire par là que l'éducation"                                                                                                      
[11] "ignore c c que la plus petite des Plsa connaît par coeur :"                                                                                                       
[12] "e profil personnel, l'adéquation d'un individu à un poste,"                                                                                                       
[13] "a gestion prévisionnelle des effectifs, bref tous les rudiments de ce qu'on appelle la gestion des ressources"                                                    
[14] "humaines."                                                                                                                                                        
[15] "M. Bernard de Froment, rapporteur spécial C 'est vrai !"                                                                                                          
[16] "M. le Ministre de l'éducation nationale. Cette ignorance me parait être la source de bien des ' onctionnements et de bien des gâchis. Je crois que, ans toute vie"
[17] "professionnelle, lorsqu'un homme ou une femme n'a pas"                                                                                                            
[18] "la conscience d'être la personne qu'il faut à l'endroit qu'il"                                                                                                    
[19] "faut, il se décourage et n'obtient pas les résultats qu'on"                                                                                                       
[20] "pourrait attendre de lui . Dans le cadre particulier de"                                                                                                          
[21] "l'école, cela risque en outre de faire tache d'huile parce"                                                                                                       
[22] "ue c'est l'ambiance de tout 'an étaldissttnent qui risque"                                                                                                        
[23] "'en souffrir. C'est pourquoi la décision que j 'ai prise de"                                                                                                      
[24] "cesser de nommer des e nseign a rts-débutants sur des"                                                                                                            
[25] "postes articulièrement . difficiles (Applaudissements sur les"                                                                                                    
[26] "pana groupe de l'Union pour la démocratie francise et"                                                                                                            
[27] "du Centre et du groupe du Rassemblement pour la"                                                                                                                  
[28] "République)"                                                                                                                                                      
[29] "M. Michel Péricar d, st résident de la commission des"                                                                                                            
[30] "entres culturelles. C'est plus intelligent !"                                                                                                                     
[31] ""                                                                                                                                                                 
[32] "j"                                                                                                                                                                
[33] ""                                                                                                                                                                 
[34] "M. le ministre de l'éducation nationale . ... qui sera en"                                                                                                        
[35] ""                                                                                                                                                                 
[36] "vigueur à la rentrée 1995 . Cette décision est, à mes yeux,"                                                                                                      
[37] "essentielle . Sauf, naturellement, si l'enseignant est volontaire,..."                                                                                            
[38] "M.. Michel Périmai, président de la commission des"                                                                                                               
[39] "affaires culturelles. Et encore !"                                                                                                                                
[40] "M. le ministre de l'éducation nationale. ... ce qui est"                                                                                                          
[41] "respectable, voire souhaitable, et ce que, alors, je soutiendrai."                                                                                                
[42] "L'enjeu est de trouver la meilleure adéquation possible"                                                                                                          
[43] "d'une personne à un emploi, de tenter de concilier l'utilité sociale et l'épanouissement individuel. L'école a tout"                                              
[44] "d y gagner."                                                                                                                                                      
[45] "Il faut faire aussi confiance au terrain en apportant les"                                                                                                        
[46] "moyens d'une réponse locale, de proximité, aux demandes"                                                                                                          
[47] "des élèves. Nous savons tous ou'un a tendance à demander trop à l'école. Ors la rend responsable de situations"                                                   
[48] "qu'elle subir, «imam le chômage."                                                                                                                                 
[49] "Les responsables des dtablisserents ont à connaître de"                                                                                                           
[50] "situations de crise financière de familles. Pour donner aux"                                                                                                      
[51] "acteurs du terrain les moyens d'intervenir rapidement et"                                                                                                         
[52] "de façon souple, nous avons décidé la création d 'un"                                                                                                             
[53] "Fonds social collégien, qui cera mis en place au"                                                                                                                 
[54] "janvier 1995, et doté, pour la première année, de 100 millions de flancs, dont je souhaite que l'utilisation soit la"                                             
[55] "plus 'souple possible, afin de faciliter l'intervention des"                                                                                                      
[56] "chefs d'établissement et de ne .pas compliquer leur acheC'est la manière la plus efficace d'intervenir face à des"                                                
[57] "risques de maiginalisation, dorlt les effets sont toujours"                                                                                                       
[58] "très rapid"                                                                                                                                                       
[59] "es."                                                                                                                                                              
[60] ", C'est également dans, un souci d'efficacité et d'équité"                                                                                                        
[61] "ue le Gouvernement a prévu l'allocation exceptionnelle"                                                                                                           
[62] "r à l'article 23, alinéa 5, de la loi relative à la"                                                                                                              
[63] ""                                                                                                                                                                 
[64] "\f"                                                                                                                                                               

Note there’s a little bit of extra junk. I don’t know where the “j” in line 32 comes from, for starters.

And those OCR errors. Proceed with this type of document with extreme caution.

LS0tCnRpdGxlOiAiRGVhbGluZyB3aXRoIFBERnMiCnN1YnRpdGxlOiAiUExTQyA1OTcsIFRleHQgYXMgRGF0YSwgUGVubiBTdGF0ZSIKYXV0aG9yOiAiQnVydCBMLiBNb25yb2UiCm91dHB1dDoKICBodG1sX25vdGVib29rOgogICAgZGZfcHJpbnQ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