[Tex/LaTex] Making an invisible section title appear in pdf bookmarks

sectioning

One section of my article is a table. Because of space limitation, I cannot put section title in the same page as the table. On the other hand, I want my section title appear in pdf bookmarks. How can I define a hidden section name and make sure that it is going to appear in toc and more importantly in pdf bookmarks. By the way, I don't want to make my table smaller.

I tried the solution suggested in make section headings invisible and it doesn't work.

Best Answer

my page was basically a big table and I didn't have the luxury of entering a section name. However, I wanted the section name to appear in pdf bookmark.

\documentclass[12pt]{article}
\usepackage{url}
\usepackage[pdftex]{hyperref} %% comes last
\hypersetup{ 
pdftitle={}, 
pdfauthor={},
bookmarks=true, bookmarksopen=true, pdftoolbar=true, 
pdffitwindow=false,
colorlinks=false,
linkcolor=red, 
citecolor=red,
filecolor=magenta,
urlcolor=black }
\usepackage{bookmark}

\begin{document}    
\newpage%

% LOCATION A

\begin{table}[htb] \centering
% LOCATION B

Possible solution 1:

\newcommand\invisiblesection[1]{%
  \refstepcounter{section}%
  \addcontentsline{toc}{section}{\protect\numberline{\thesection}#1}%
  \sectionmark{#1}}
enter chapter title here
\invisiblesection{text you want to appear in pdf file}

Possible solution 2:

\pdfbookmark[1]{title}{comment}

My mistake: I tried each of these solutions in Location A.
Consequence: strangly the pdf file bookmark was linked to a very different page.

Solution: Try them at Location B